FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour Rpreview.prg
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Rpreview.prg
Posted: Mon Jan 05, 2015 04:21 PM
Hello,

Code (fw): Select all Collapse
EASYREPORT oVRD NAME ".\xVrd\MeldeX.vrd" ;
               PREVIEW lPreview  TO cPrinter OF oWnd PRINTDIALOG IIF( lPreview, .F., .F. )


Although I pass cPrinter rPreview for me is always printing to the standard printer.

Somehow oDevice:hDC is the hDC from the standard printer.

As a quick solution to go ahead with our yearly updates I use this fix.
Best regards,
Otto



Code (fw): Select all Collapse
METHOD PrintPrv( oDlg, nOption, nPageIni, nPageEnd ) CLASS TPreview

   local oDevice := ::oDevice   // DEVICE
   local aFiles  := oDevice:aMeta
   local hMeta   := ::oMeta1:hMeta
   local nFor

   CursorWait()

    //xbrowse( oDevice )  
    
   //? oDevice:hDC
   
   oDevice:hDC = PrinterDcFromName( , oDevice:cModel, )
   
   //? oDevice:hDC

StartDoc( oDevice:hDC, oDevice:cDocument )
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Rpreview.prg
Posted: Mon Jan 05, 2015 04:29 PM

Otto,

many thaks for sharing your fix :-)

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Rpreview.prg
Posted: Mon Jan 05, 2015 06:56 PM
Hello Antonio,
I removed the changes from rpreview and inserted following code into my program.
Best regards,
Otto
Code (fw): Select all Collapse
cOldPrinter := GetProfString( "windows", "device" , "" )

WriteProfString( "windows", "device", cPrinter )
SysRefresh()
PrinterInit()

EASYREPORT oVRD NAME ".\xVrd\MeldeX.vrd" ;
PREVIEW lPreview  TO cPrinter OF oWnd PRINTDIALOG IIF( lPreview, .F., .F. )
//----------------------------------------------------------------------------//
...
//----------------------------------------------------------------------------//
END EASYREPORT oVRD
//restore printer
SysRefresh()
WriteProfString( "windows", "device", cOldPrinter )
Posts: 3022
Joined: Fri Oct 07, 2005 01:45 PM
Re: Rpreview.prg
Posted: Mon Jan 05, 2015 10:12 PM

Otto,

How are you implementing Easy Report in your program ?

When when we started this, I had hoped for an option in the FWH libs that allowed us to include the Easy Report generator so clients could actually build custom reports themselves.

So far, all I have seen in the available download was a free standing .exe for EasyReport. Appareantly I am missing something.

Tim

Tim Stone
http://www.MasterLinkSoftware.com
http://www.autoshopwriter.com
timstone@masterlinksoftware.com
Using: FWH 23.10 with Harbour 3.2.0 / Microsoft Visual Studio Community 2022-24 32/64 bit
Posts: 44158
Joined: Thu Oct 06, 2005 05:47 PM
Re: Rpreview.prg
Posted: Mon Jan 05, 2015 10:36 PM

Otto,

yes, Tim's question is very important. What EasyReport are you using ?

Have you been able to use the most recent code from Manuel and Cristobal ?

many thanks

regards, saludos

Antonio Linares
www.fivetechsoft.com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Rpreview.prg
Posted: Mon Jan 05, 2015 11:58 PM

Hello Antonio,

I am using the latest vrd.prg from Timm to print.

As EasyReport designer the last latest version from Timm.
This was for me the most stable one.

Best regards,
Otto

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: Rpreview.prg
Posted: Tue Jan 06, 2015 08:38 AM

Hello Antonio,

yes you are right.
The following files should be included into Fivewin.libs and in Fivewin sources. These are necessary for printing with EasyReport.
vrd.ch
vrd.prg
vrdbcode.prg
vrditem.prg

Best regards,
Otto

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: Rpreview.prg
Posted: Tue Jan 06, 2015 03:48 PM
Mr Otto

The problem is in the printer.prg. Rebuild() method of printer class is resetting the printer to default printer.
Please apply the following fix to Method Rebuild() of printer.prg

Existing code:
Code (fw): Select all Collapse
   if ::hDC != 0
      DeleteDC( ::hDC )
      ::hDC := GetPrintDefault( GetActiveWindow() )
      ::lStarted   := .F.
      ::lModified  := .T.
   endif

Replace this code by:
Code (fw): Select all Collapse
   if ::hDC != 0
      DeleteDC( ::hDC )
      if !( ',' $ ::cModel ) // printer specified by programmer as xModel : 2015-01-06
         ::hDC = PrinterDcFromName( , ::cModel, )
      else
         ::hDC := GetPrintDefault( GetActiveWindow() )
      endif
      ::lStarted   := .F.
      ::lModified  := .T.
   endif
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion