FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour PageBreak
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
PageBreak
Posted: Tue Jun 28, 2016 07: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 March-April 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
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: PageBreak
Posted: Tue Jun 28, 2016 06: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 (fw): Select all Collapse
//----------------------------------------------------------------------------//

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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: PageBreak
Posted: Wed Jun 29, 2016 07: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 March-April 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
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: PageBreak
Posted: Wed Jun 29, 2016 08:09 AM
I found this function but I not Know how converte into fwh

Code (fw): Select all Collapse
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 March-April 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

Continue the discussion