PageBreak

PageBreak

Postby Silvio.Falconi » Tue Jun 28, 2016 7:40 am

To made a PageBreak on rtf we need only call the function PageBreak
but it not show nothing on rtf document
then If I use the preview I see two page

is it possible draw a line into rtf document with a symbol "⌂" at the end of this line ?

Another If we want erase the pagebreack we cannot
if there is the line I wish create perhaps we can erase the pagebreack from rtf document
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: PageBreak

Postby cnavarro » Tue Jun 28, 2016 6:11 pm

Silvio, this is a way to implement it, but sure there's a better way

New DATA lShowPageBreak INIT .F.

New METHODS
Code: Select all  Expand view

//----------------------------------------------------------------------------//

METHOD ShowPageBreak() CLASS TRichEdit5

   local nOldLine      := ::GetRow()
   if !::lShowPageBreak
      ::lShowPageBreak := .T.
      ::GoToLine( 1 )
      ::ReplaceAll( , Chr( 12 ), .T., .F., .T., .T., "«»»", .F. )
      ::GoToLine( nOldLine )      
   //else
      //::Find( "«»»", .T., .F., .T. )
      //MsgInfo( "Page Break Symbols Actives", "Attention" )
   endif

Return nil

//----------------------------------------------------------------------------//

METHOD HidePageBreak() CLASS TRichEdit5

   local nOldLine      := ::GetRow()
   if ::lShowPageBreak
      ::lShowPageBreak := .F.
      ::GoToLine( 1 )
      ::ReplaceAll( , "«»»", .T., .F., .T., .T., Chr( 12 ), .F. )
      ::GoToLine( nOldLine )      
   //else
      //::Find( Chr( 12 ), .T., .F., .T. )
      //MsgInfo( "Page Break Symbols Inactives", "Attention" )
   endif

Return nil

//----------------------------------------------------------------------------//
 


You should not forget in the methods and printing functions include a call to the method HidePageBreak
Cristobal Navarro
Hay dos tipos de personas: las que te hacen perder el tiempo y las que te hacen perder la noción del tiempo
El secreto de la felicidad no está en hacer lo que te gusta, sino en que te guste lo que haces
User avatar
cnavarro
 
Posts: 6541
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: PageBreak

Postby Silvio.Falconi » Wed Jun 29, 2016 7:32 am

how I must active this data from Pagebreack ?

If I insert :lShowPageBreak := .T. then all :lShowPageBreak are true

METHOD PageBreak() INLINE REPageBreak( ::hWnd )

I think we must change REPageBreak( ::hWnd )

it must draw a graphic line on richedit control with a symbol
then the user can erase it as a object

and the reprint and repreview (function on Richedit.c) must Know this symbol as a page breack

it seem a weffect of PARAFORMAT2 (PFM_PAGEBREAKBEFORE)
https://msdn.microsoft.com/en-us/librar ... 42(v=vs.85).aspx
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm

Re: PageBreak

Postby Silvio.Falconi » Wed Jun 29, 2016 8:09 am

I found this function but I not Know how converte into fwh

Code: Select all  Expand view

static DWORD CALLBACK PageBreakCallBack(DWORD dwCookie, LPBYTE lpBuffer, LONG lSize, LONG *plWrite)
{
    LONG c;
    char szString[] = "{\\rtf\\page \\par}\0";

    c = lSize;
    c = lstrlen(szString);
    if (*plWrite > c) {
        lstrcpyn(lpBuffer, szString, c+1);
        *plWrite = c;
         return 0// keep on reading
    } else return c;    // stop it
}

int InsertPageBreak(HWND hWndRE)
{
    EDITSTREAM es;
    CHARRANGE crSel;
    DWORD nRead;

    SendMessage(hWndEdit, EM_EXGETSEL, 0, (LPARAM)&crSel);
    crSel.cpMax = crSel.cpMin;  // safe
    SendMessage(hWndEdit, EM_EXSETSEL, 0, (LPARAM)&crSel);

    es.dwCookie = 0;
    es.dwError = 0;
    es.pfnCallback = PageBreakCallBack;

    nRead = SendMessage(hWndRE, EM_STREAMIN, SF_RTF | SFF_SELECTION, (LPARAM) &es);
    return nRead;
}
 
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7056
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 80 guests