A sample to print with REPrintBox5 a memo on two pages ?

Re: A sample to print with REPrintBox5 a memo on two pages ?

Postby ukoenig » 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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A sample to print with REPrintBox5 a memo on two pages ?

Postby Marc Venken » 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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: A sample to print with REPrintBox5 a memo on two pages ?

Postby ukoenig » Sun Feb 25, 2018 11:56 am

Marc,

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

Image

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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A sample to print with REPrintBox5 a memo on two pages ?

Postby Marc Venken » 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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: A sample to print with REPrintBox5 a memo on two pages ?

Postby ukoenig » 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 :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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A sample to print with REPrintBox5 a memo on two pages ?

Postby cnavarro » Sun Feb 25, 2018 12:33 pm

Try this also

Code: Select all  Expand view


#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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: A sample to print with REPrintBox5 a memo on two pages ?

Postby Marc Venken » Sun Feb 25, 2018 6: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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: A sample to print with REPrintBox5 a memo on two pages ?

Postby cnavarro » Sun Feb 25, 2018 6:54 pm

You are right, it's my mistake

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

Please, change and add this code

Code: Select all  Expand view

   @ 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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: A sample to print with REPrintBox5 a memo on two pages ?

Postby Marc Venken » Sun Feb 25, 2018 8: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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1343
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: A sample to print with REPrintBox5 a memo on two pages ?

Postby cnavarro » Sun Feb 25, 2018 8: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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: A sample to print with REPrintBox5 a memo on two pages ?

Postby ukoenig » Sun Feb 25, 2018 8: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: Select all  Expand view

#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 :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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A sample to print with REPrintBox5 a memo on two pages ?

Postby ukoenig » Sun Feb 25, 2018 8: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: Select all  Expand view

#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 :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.
User avatar
ukoenig
 
Posts: 4043
Joined: Wed Dec 19, 2007 6:40 pm
Location: Germany

Re: A sample to print with REPrintBox5 a memo on two pages ?

Postby cnavarro » Sun Feb 25, 2018 8: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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Re: A sample to print with REPrintBox5 a memo on two pages ?

Postby cnavarro » Sun Feb 25, 2018 9:03 pm

Ah!, sorry

Remove calls to the method SetText

Code: Select all  Expand view


      :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
User avatar
cnavarro
 
Posts: 6500
Joined: Wed Feb 15, 2012 8:25 pm
Location: España

Previous

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Silvio.Falconi and 78 guests