Page 2 of 2

Re: Richedit( ) function problems

PostPosted: Wed Jun 29, 2016 10:01 pm
by TimStone
So if I want to use the PRINTER class, what control would I use to send the output ?

Will it display properly in the Preview of a print document ?

What are the RichText controls for a resource file ?

Thank you.

Re: Richedit( ) function problems

PostPosted: Thu Jun 30, 2016 6:12 am
by Antonio Linares
Tim,

For your third question, please review FWH\samples\testrich.rc

Re: Richedit( ) function problems

PostPosted: Thu Jun 30, 2016 6:18 am
by Antonio Linares
Tim,

In FWH\samples\testrtf.prg function PrintBox( lPreview ) you have an example to preview or print a richedit

Code: Select all  Expand view
static function PrintBox( lPreview )

   local oPrn
   local aRTF := { 100, 1000 }  // { nFrom, nTop }

   DEFAULT lPreview := .f.

   if lPreview
      PRINT oPrn NAME "FWH RICHEDIT FILE" PREVIEW
   else
      PRINT oPrn NAME "FWH RICHEDIT FILE"
   endif

      if Empty( oPrn:hDC )
         MsgStop( "Printer not ready!" )
         return nil
      endif

      PAGE
         CursorWait()
         oPrn:Box( aRTF[ 2 ], 500, aRTF[ 2 ] + 1000, 1500 )

         aRTF := REPrintBox( oRTF:hWnd, If( lPreview, oPrn:hDCOut, oPrn:hDC ), ;
                             oRTF:IsSelection(), ;
                             aRTF[ 2 ] + 10, 510, 1490, aRTF[ 2 ] + 990, aRTF[ 1 ] )

         oPrn:Box( aRTF[ 2 ], 500, aRTF[ 2 ] + 1000, 1500 )

         aRTF := REPrintBox( oRTF:hWnd, If( lPreview, oPrn:hDCOut, oPrn:hDC ), ;
                             oRTF:IsSelection(), ;
                             aRTF[ 2 ] + 10, 510, 1490, aRTF[ 2 ] + 990, aRTF[ 1 ] )

         oPrn:Box( aRTF[ 2 ], 500, aRTF[ 2 ] + 1000, 1500 )

         aRTF := REPrintBox( oRTF:hWnd, If( lPreview, oPrn:hDCOut, oPrn:hDC ), ;
                             oRTF:IsSelection(), ;
                             aRTF[ 2 ] + 10, 510, 1490, aRTF[ 2 ] + 990, aRTF[ 1 ] )

         CursorArrow()
      ENDPAGE

   ENDPRINT

return nil

Re: Richedit( ) function problems

PostPosted: Thu Jun 30, 2016 7:54 am
by Silvio.Falconi
Antonio,
How I can make to show with Lines dotted the margins of Rtf document on rPreview ?
Good can be the possibility to drag and drop this lines and move the margins directly on rpreview
Regards

Re: Richedit( ) function problems

PostPosted: Thu Jun 30, 2016 8:49 am
by Antonio Linares
Silvio,

The preview uses metafiles. We can't interact with them.

A complete new preview engine would have to be built

Re: Richedit( ) function problems

PostPosted: Thu Jun 30, 2016 5:08 pm
by TimStone
Thank you. I will work with this. It is an enhancement so I don't need to have it working today.

Is there documentation somewhere that explains using RTF. I've looked at those samples, but I like to understand how something works and samples don't always explain that.

Tim

Re: Richedit( ) function problems

PostPosted: Thu Jun 30, 2016 6:16 pm
by Antonio Linares
Tim,

FWH RichEdit is just a wrapper (more or less) to Windows RichEdit:

https://msdn.microsoft.com/en-us/library/windows/desktop/bb787873(v=vs.85).aspx

Re: Richedit( ) function problems

PostPosted: Sat Jul 02, 2016 8:40 am
by Silvio.Falconi
Antonio Linares wrote:Silvio,

The preview uses metafiles. We can't interact with them.

A complete new preview engine would have to be built



Antonio,
I think it can be made adding commands to Tmetafile class
When I tried to make Vrd I used a class Tpaper it was Tmetafile with mousemove commands and then there was Items as lines and boxes
I not remember where I put the sources...


On Informes.prg (C5ide.zop) we can found :
CLASS TRptItem
CLASS TRptLineItem FROM TRptItem
CLASS TSoporte or Tbanda is as tmetafile class

perhaps we have all

Re: Richedit( ) function problems

PostPosted: Sat Jul 02, 2016 9:19 am
by Antonio Linares
> there was Items as lines and boxes

on top of it ?

Or do you mean modifying the metafile at runtime ?

Re: Richedit( ) function problems

PostPosted: Sat Jul 02, 2016 10:21 am
by Silvio.Falconi
I cannot search my source because I cannot open my pcPortable I'm waiting new power supply from Usa from 20days ( I'm usinf the pc at work :))
but I saw on delphi it make a line and with the mouse move this line and move the margins
but you say it is impossible ok

Re: Richedit( ) function problems

PostPosted: Sat Jul 02, 2016 10:23 am
by Antonio Linares
metafiles are not editables as far as I know

Re: Richedit( ) function problems

PostPosted: Sat Jul 02, 2016 11:17 am
by Silvio.Falconi
ok
but for a sample ...MyRpt use TPreview() class ( this class use hmetafile)

and u can insert a box into and move it ....with the mouse ...

I think it can be insert two vertical lines and two horizontal line to set the margins

Re: Richedit( ) function problems

PostPosted: Sat Jul 02, 2016 5:11 pm
by cnavarro
TimStone wrote:So if I want to use the PRINTER class, what control would I use to send the output ?

Will it display properly in the Preview of a print document ?

What are the RichText controls for a resource file ?

Thank you.


If you wants to create a report with the contents of the memo field with rich text, look at this example

Download Exe, prg, and database file in
https://bitbucket.org/fivetech/fivewin- ... eprich.zip

Image