FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour A sample to print with REPrintBox5 a memo on two pages ?
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: A sample to print with REPrintBox5 a memo on two pages ?
Posted: Sun Feb 25, 2018 10:44 AM

Marc,

Just a idea.
Using the setup-section and define the editor You are working with.
That will open the memo with Your favorite editor.
The memo will be saved as a textfile before and opend with Your editor

regards
Uwe :D

Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: A sample to print with REPrintBox5 a memo on two pages ?
Posted: Sun Feb 25, 2018 11:52 AM

Uwe,

This would totaly fit for my needs :wink: :wink: (Also others...)

A Second section for the option to start the sample ( for me this is simple the buildh.bat sample.prg would complete the tool !!

Edit : me sample.prg
Run : buildh sample.prg

as 2 input fields.

I would suggest not to go to far into this, just 1 start option for Edit en Run, because otherwise the sampler will become a other program.

Marc

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: A sample to print with REPrintBox5 a memo on two pages ?
Posted: Sun Feb 25, 2018 11:56 AM
Marc,

I added the editor-solution
Works PERFECT :-) :-)
I can open the memo with my program-editor defined in the setup-section.



regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: A sample to print with REPrintBox5 a memo on two pages ?
Posted: Sun Feb 25, 2018 12:15 PM

Yes...

BTW : Wich program do you use to make those jpg's and balloons ?

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: A sample to print with REPrintBox5 a memo on two pages ?
Posted: Sun Feb 25, 2018 12:23 PM
Marc,

I'm using SNAGIT ( commercial )
but I remember there is a program ( freeware ) that comes very close to it.
I have to look for it.

regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: A sample to print with REPrintBox5 a memo on two pages ?
Posted: Sun Feb 25, 2018 12:33 PM
Try this also

Code (fw): Select all Collapse
#include "FiveWin.ch"
#include "RichEdi5.ch"

Static hDll
Static oDlg
Static oBrw
Static oMemo

function Main()

  local cTitle:="Test"
  local cResult
  local oFont, oBold
  local oSay
  local oCode

  REQUEST DBFCDX

   USE clients via "DBFCDX" NEW

   DEFINE FONT oFont NAME "Courier New" SIZE 8,15
   DEFINE FONT oBold NAME "Courier New" BOLD SIZE 8,15

   DEFINE DIALOG oDlg FROM 5,10 TO 50, 170 font oFont TITLE "Test Color"

   @ 10, 10 XBROWSE oBrw OF oDlg ;
      SIZE 350, 200 PIXEL ;
      COLUMNS 'Name', 'Adress', 'Notes' ;
      ALIAS 'CLIENTS' NOBORDER

   WITH OBJECT oBrw

      :nColDividerStyle := LINESTYLE_LIGHTGRAY
      :nRowDividerStyle := LINESTYLE_LIGHTGRAY
      :bClrRowFocus     := { || { CLR_BLACK, RGB(185,220,255) } }
      :nMarqueeStyle    := MARQSTYLE_HIGHLROWMS

      :bChange := { || oSay:refresh(),showmemo() }

      :CreateFromCode()
   END
   @ 250, 10 BUTTON "Code" PIXEL ACTION ( oCode := SourceEdit( oMemo:GetText() , "Code", , 100, 300, 700, 1160, , , , , , ,  ) )

   @ 10,370 SAY oSay PROMPT clients->notes SIZE 200, 80 PIXEL OF oDlg COLOR CLR_BLACK update  //TRANSPARENT

   ACTIVATE DIALOG oDlg CENTERED ON INIT showmemo()

   close all
   FreeLibrary( hDll )

Return nil

function showmemo()

   Local cStr     := ""
   local cChange  := "FiveWin"   //  Word that we will look for
   local cInto    := "\highlight1 FiveWin \highlight0"  // Put Word in Color
   local cText
   local cVar     := ""

   cText   := clients->notes

   cStr    += "{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang3082{\fonttbl{\f0\fnil\fcharset0 Tahoma;}}"
   cStr    += "{\colortbl ;\red255\green0\blue0;\red0\green0\blue0;\red128\green64\blue64;\red0\green0\blue128;}"
   cStr    += "\viewkind4\uc1"
   cStr    += "\pard\fs20" + if( Empty( cText ), " ", cText )
   cStr    += "}"
   cStr    := StrTran( cStr, cChange, cInto )

   if hb_Isnil( oMemo )
      @ 180,740 RICHEDIT5 oMemo VAR cVar of oDlg PIXEL SIZE 450, 400 HIGHLIGHT
   endif
   oMemo:LoadRTF( cStr, .F. )

return NIL
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: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: A sample to print with REPrintBox5 a memo on two pages ?
Posted: Sun Feb 25, 2018 06:39 PM

This is very close to what is wanted.

I get this error however : (when I try to save)

Application

Path and name: C:\fwharb\samples\mycolor2.exe (32 bits)
Size: 3,895,808 bytes
Compiler version: Harbour 3.2.0dev (r1506171039)
FiveWin version: FWH 17.05
C compiler version: Borland/Embarcadero C++ 7.0 (32-bit)
Windows version: 6.1, Build 7601 Service Pack 1

Time from start: 0 hours 0 mins 58 secs
Error occurred at: 02/25/18, 19:37:21
Error description: Error BASE/1004 Message not found: TBTNBMP:OACTIVO
Args:
[ 1] = O TBTNBMP

Stack Calls

Called from: => __ERRRT_SBASE( 0 )
Called from: ../../../tobject.prg => TBTNBMP:ERROR( 0 )
Called from: ../../../tobject.prg => (b)HBOBJECT( 0 )
Called from: ../../../tobject.prg => TBTNBMP:MSGNOTFOUND( 0 )
Called from: ../../../tobject.prg => TBTNBMP:OACTIVO( 0 )
Called from: .\source\function\MEMOEDIT.PRG => (b)SOURCEEDIT( 467 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:CLICK( 683 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:LBUTTONUP( 919 )
Called from: .\source\classes\CONTROL.PRG => TCONTROL:HANDLEEVENT( 1721 )
Called from: .\source\classes\BTNBMP.PRG => TBTNBMP:HANDLEEVENT( 1866 )
Called from: .\source\classes\WINDOW.PRG => _FWH( 3325 )
Called from: => DIALOGBOXINDIRECT( 0 )
Called from: .\source\classes\DIALOG.PRG => TDIALOG:ACTIVATE( 296 )
Called from: mycolor2.prg => MAIN( 96 )

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: A sample to print with REPrintBox5 a memo on two pages ?
Posted: Sun Feb 25, 2018 06:54 PM
You are right, it's my mistake

In Memoedit.prg
At moment, change in button "Save" ACTION :: with oEditor variable

Please, change and add this code

Code (fw): Select all Collapse
   @ 04,82 BTNBMP PROMPT "<" SIZE 16,16 PIXEL OF oDlg NOBORDER FONT oFontWD2 ;
      COLOR CLR_BLACK, CLR_WHITE ;
      TOOLTIP FWString( "Save" ) ;        //Save As
      ACTION ( SaveFileSource( oEditor, oEditor:cFileName ) )

// and at end of memoedit.prg add

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

Static Function SaveFileSource( oEditor, cFile )

   if Empty( cFile ) .or. !Empty( At( "noname", Lower( cFile ) ) )
   cFile       := cGetFile32( "Program file (*.prg) |*.prg|" + ;
                        "Header file (*.ch) |*.ch|" + ;
                        "Headers (*.h) |*.h|" + ;
                        "Resources (*.rc) |*.rc|" + ;
                        "Source Code C (*.c) |*.c|" + ;
                        "Source Code C++ (*.cpp) |*.cpp|" + ;
                        "C File (*.cxx) |*.cxx|" + ;
                        "Harbour files (*.hrb) |*.hrb|" + ;
                        "Templates (*.pvk) |*.pvk|" + ;
                        "Text file (*.txt) |*.txt|" + ;
                        "Configuration file (*.ini) |*.ini|" + ;
                        "HTML Page file (*.html) |*.html|" + ;
                        "HTM Page file (*.htm) |*.htm|" + ;
                        "TPL Page Template file (*.tpl) |*.tpl|" + ;
                        "XML file (*.xml) |*.xml|",;
                        "Save as", 0, ;
                         hb_CurDrive() + ":\" + CurDir(), .T., .T. )
   endif
   oEditor:Save( , , , , , cFile )

Return nil

//----------------------------------------------------------------------------//
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: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: A sample to print with REPrintBox5 a memo on two pages ?
Posted: Sun Feb 25, 2018 08:14 PM

Thanks.

Uwe, I let this for you to do because I never have changed stuff from FW prog's itself. (Maybe i have to link/compile them and that kind of stuff)

@ Cristobal : You may put a link to a Exe for me to test, but I get the idea. Mr. Uwe will implement it at a given moment.

Marc Venken

Using: FWH 23.08 with Harbour
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: A sample to print with REPrintBox5 a memo on two pages ?
Posted: Sun Feb 25, 2018 08:39 PM
Marc Venken wrote:Thanks.

Uwe, I let this for you to do because I never have changed stuff from FW prog's itself. (Maybe i have to link/compile them and that kind of stuff)

@ Cristobal : You may put a link to a Exe for me to test, but I get the idea. Mr. Uwe will implement it at a given moment.


Marc, for your test, too easy
Copy function SourceEdit from MEMOEDIT.PRG and paste it into your sample ( at end of document ) and put your modification
Compile and build normaly
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: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: A sample to print with REPrintBox5 a memo on two pages ?
Posted: Sun Feb 25, 2018 08:44 PM
Cristobal,

I did some changes to the sample
because of a colored dialog You can see that the memo gets repainted again and again
With my changes the memo is painted only once and after that a text replacement.
Maybe You can have a look at it

Code (fw): Select all Collapse
#include "FiveWin.ch"
#include "RichEdi5.ch"

Static oDlg, oBrw, oMemo

FUNCTION MAIN()
local cTitle:="Test"
local cResult, cText
local oFont, oBold, oBrush
local oSay, cFilter := "FiveWin"

REQUEST DBFCDX

USE clients via "DBFCDX" NEW
cText 聽 := clients->notes

DEFINE FONT oFont NAME "Courier New" SIZE 8,15
DEFINE FONT oBold NAME "Courier New" BOLD SIZE 8,15
DEFINE BRUSH oBrush COLOR 16763283

DEFINE DIALOG oDlg FROM 5,10 TO 50, 170 font oFont TITLE "Test Color" 

@ 10, 10 XBROWSE oBrw OF oDlg ;
聽 聽 聽 SIZE 350, 200 PIXEL ;
聽 聽 聽 COLUMNS 'Name', 'Adress', 'Notes' ;
聽 聽 聽 ALIAS 'CLIENTS' NOBORDER

WITH OBJECT oBrw
聽 聽 聽 :nColDividerStyle := LINESTYLE_LIGHTGRAY
聽 聽 聽 :nRowDividerStyle := LINESTYLE_LIGHTGRAY
聽 聽 聽 :bClrRowFocus 聽 聽 := { || { CLR_BLACK, RGB(185,220,255) } }
聽 聽 聽 :nMarqueeStyle 聽 聽:= MARQSTYLE_HIGHLROWMS

聽 聽 聽 :bChange := { ||聽 oSay:refresh(), ;
聽 聽 聽 聽 聽 聽 聽 聽 cText := clients->notes, oMemo:SetText( cText ), ;
聽 聽 聽 聽 聽 聽 聽 聽 oMemo:LoadRTF( SHOWMEMO(cText, cFilter), .F. ), ;
聽 聽 聽 聽 聽 聽 聽 聽 oMemo:GoToLine( 1 ) }

聽 聽 聽 :CreateFromCode()
END

@ 10, 370 SAY oSay PROMPT clients->notes SIZE 200, 80 PIXEL OF oDlg COLOR CLR_BLACK update 聽//TRANSPARENT

@ 120,370 RICHEDIT5 oMemo VAR cText of oDlg PIXEL SIZE 250, 200 

ACTIVATE DIALOG oDlg CENTERED ON INIT ;
( oDlg:SetBrush( oBrush ), ;
聽 oMemo:SetText( cText ), ;
聽 oMemo:LoadRTF( SHOWMEMO(cText, cFilter), .F. ), ;
聽 oMemo:GoToLine( 1 ) )

RELEASE BRUSH oBrush

CLOSE ALL

RETURN NIL

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

FUNCTION SHOWMEMO(cText, cFilter)
Local cStr 聽 聽 := ""
local cInto 聽 聽:= "\highlight1" + cFilter + "\highlight0" 聽// Put Word in Color
local cVar 聽 聽 := ""

cStr 聽 聽+= "{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang3082{\fonttbl{\f0\fnil\fcharset0 Tahoma;}}"
cStr 聽 聽+= "{\colortbl ;\red255\green0\blue0;\red0\green0\blue0;\red128\green64\blue64;\red0\green0\blue128;}"
cStr 聽 聽+= "\viewkind4\uc1"
cStr 聽 聽+= "\pard\fs20" + if( Empty( cText ), " ", cText )
cStr 聽 聽+= "}"
cStr 聽 聽:= StrTran( cStr, cFilter, cInto ) // 聽Word that we will look for

RETURN cStr


regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 4043
Joined: Wed Dec 19, 2007 06:40 PM
Re: A sample to print with REPrintBox5 a memo on two pages ?
Posted: Sun Feb 25, 2018 08:49 PM
Cristobal,

I did some changes to the sample
because of a colored dialog You can see that the memo gets painted again and again
With my changes the memo is painted only once and after that a text replacement.
Maybe You can have a look at it

Code (fw): Select all Collapse
#include "FiveWin.ch"
#include "RichEdi5.ch"

Static oDlg, oBrw, oMemo

FUNCTION MAIN()
local cTitle:="Test"
local cResult, cText
local oFont, oBold, oBrush
local oSay, cFilter := "FiveWin"

REQUEST DBFCDX

USE clients via "DBFCDX" NEW
cText 聽 := clients->notes

DEFINE FONT oFont NAME "Courier New" SIZE 8,15
DEFINE FONT oBold NAME "Courier New" BOLD SIZE 8,15
DEFINE BRUSH oBrush COLOR 16763283

DEFINE DIALOG oDlg FROM 5,10 TO 50, 170 font oFont TITLE "Test Color" 

@ 10, 10 XBROWSE oBrw OF oDlg ;
聽 聽 聽 SIZE 350, 200 PIXEL ;
聽 聽 聽 COLUMNS 'Name', 'Adress', 'Notes' ;
聽 聽 聽 ALIAS 'CLIENTS' NOBORDER

WITH OBJECT oBrw
聽 聽 聽 :nColDividerStyle := LINESTYLE_LIGHTGRAY
聽 聽 聽 :nRowDividerStyle := LINESTYLE_LIGHTGRAY
聽 聽 聽 :bClrRowFocus 聽 聽 := { || { CLR_BLACK, RGB(185,220,255) } }
聽 聽 聽 :nMarqueeStyle 聽 聽:= MARQSTYLE_HIGHLROWMS

聽 聽 聽 :bChange := { ||聽 oSay:refresh(), ;
聽 聽 聽 聽 聽 聽 聽 聽 cText := clients->notes, oMemo:SetText( cText ), ;
聽 聽 聽 聽 聽 聽 聽 聽 oMemo:LoadRTF( SHOWMEMO(cText, cFilter), .F. ), ;
聽 聽 聽 聽 聽 聽 聽 聽 oMemo:GoToLine( 1 ) }

聽 聽 聽 :CreateFromCode()
END

@ 10, 370 SAY oSay PROMPT clients->notes SIZE 200, 80 PIXEL OF oDlg COLOR CLR_BLACK update 聽//TRANSPARENT

@ 120,370 RICHEDIT5 oMemo VAR cText of oDlg PIXEL SIZE 250, 200 

ACTIVATE DIALOG oDlg CENTERED ON INIT ;
( oDlg:SetBrush( oBrush ), ;
聽 oMemo:SetText( cText ), ;
聽 oMemo:LoadRTF( SHOWMEMO(cText, cFilter), .F. ), ;
聽 oMemo:GoToLine( 1 ) )

RELEASE BRUSH oBrush

CLOSE ALL

RETURN NIL

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

FUNCTION SHOWMEMO(cText, cFilter)
Local cStr 聽 聽 := ""
local cInto 聽 聽:= "\highlight1" + cFilter + "\highlight0" 聽// Put Word in Color
local cVar 聽 聽 := ""

cStr 聽 聽+= "{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang3082{\fonttbl{\f0\fnil\fcharset0 Tahoma;}}"
cStr 聽 聽+= "{\colortbl ;\red255\green0\blue0;\red0\green0\blue0;\red128\green64\blue64;\red0\green0\blue128;}"
cStr 聽 聽+= "\viewkind4\uc1"
cStr 聽 聽+= "\pard\fs20" + if( Empty( cText ), " ", cText )
cStr 聽 聽+= "}"
cStr 聽 聽:= StrTran( cStr, cFilter, cInto ) // 聽Word that we will look for

RETURN cStr


regards
Uwe :-)
Since 1995 ( the first release of FW 1.9 )

i work with FW.

If you have any questions about special functions, maybe i can help.
Posts: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: A sample to print with REPrintBox5 a memo on two pages ?
Posted: Sun Feb 25, 2018 08:55 PM

Uwe, your sample run OK for me
what's your problem?
I do not notice that the control is repainted

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: 6755
Joined: Wed Feb 15, 2012 08:25 PM
Re: A sample to print with REPrintBox5 a memo on two pages ?
Posted: Sun Feb 25, 2018 09:03 PM
Ah!, sorry

Remove calls to the method SetText

Code (fw): Select all Collapse
聽 聽 聽 :bChange := { || 聽oSay:refresh(), ;
聽 聽 聽 聽 聽 聽 聽 聽 cText := clients->notes, ; //oMemo:SetText( cText ), ;
聽 聽 聽 聽 聽 聽 聽 聽 oMemo:LoadRTF( SHOWMEMO(cText, cFilter), .F. ), ;
聽 聽 聽 聽 聽 聽 聽 聽 oMemo:GoToLine( 1 ) }

聽 聽 聽 :CreateFromCode()
END

@ 10, 370 SAY oSay PROMPT clients->notes SIZE 200, 80 PIXEL OF oDlg COLOR CLR_BLACK //update 聽//TRANSPARENT

@ 120,370 RICHEDIT5 oMemo VAR cText of oDlg PIXEL SIZE 250, 200 //HIGHLIGHT

ACTIVATE DIALOG oDlg CENTERED ON INIT ;
( oDlg:SetBrush( oBrush ), ;// 聽oMemo:SetText( cText ), ;
聽 oMemo:LoadRTF( SHOWMEMO(cText, cFilter), .F. ), ;
聽 oMemo:GoToLine( 1 ) )
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

Continue the discussion