FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour HOW TO DISPLAYXBROWSE REPORT IN CUSTOMIZED PREVIEW ?
Posts: 76
Joined: Fri Aug 28, 2009 05:25 AM
HOW TO DISPLAYXBROWSE REPORT IN CUSTOMIZED PREVIEW ?
Posted: Mon Sep 25, 2023 05:36 PM

Dear Rao Sir ,

Could you please help me in displaying/Preview Report in Customer PREVIEW WINOW using XBROWSE :Report() method. Thanks in advance...!

Thanks

Shridhar

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: HOW TO DISPLAYXBROWSE REPORT IN CUSTOMIZED PREVIEW ?
Posted: Mon Sep 25, 2023 07:25 PM

Calling oBrw:Report() will automatically display the report in a preview window.

Regards



G. N. Rao.

Hyderabad, India
Posts: 76
Joined: Fri Aug 28, 2009 05:25 AM
Re: HOW TO DISPLAYXBROWSE REPORT IN CUSTOMIZED PREVIEW ?
Posted: Tue Sep 26, 2023 04:52 AM

Dear Rao Sir ,

The oBrw:Report() open its own Preview , I want to display Preview in the user defined window along with the Custom buttons. The window size will have different size and also button size/shape .

Thanks

Shridhar

Posts: 10733
Joined: Sun Nov 19, 2006 05:22 AM
Re: HOW TO DISPLAYXBROWSE REPORT IN CUSTOMIZED PREVIEW ?
Posted: Tue Sep 26, 2023 10:42 AM
If you have your own preview function, you can set it globally.
Code (fw): Select all Collapse
bPrevious := SetCustomPrintPreview( { |oDevice, oReport| MyPreview( oDevice, oReport ) } )
and keep changing whenever you want.

You can try this example to begin with.
Code (fw): Select all Collapse
#include "fivewin.ch"

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

function Main()

   local oRep, oFont

   SetCustomPrintPreview( { |oDevice, oReport| MyPreview( oDevice, oReport ) } )

   XBROWSER "CUSTOMER.DBF"

return nil

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

function MyPreview( oDevice, oReport )

   local aMeta, oWnd, oFont, oBrush, oBrw, oImage
   local lExit := .f.

   DEFINE FONT oFont NAME "TAHOMA" SIZE 0,-15
   DEFINE BRUSH oBrush FILE "..\bitmaps\backgrnd\stone.bmp"
   DEFINE WINDOW oWnd
   oWnd:SetFont( oFont )

   DEFINE BUTTONBAR oWnd:oBar SIZE 100,32 2007
   SET MESSAGE OF oWnd TO "" 2007

   DEFINE BUTTON OF oWnd:oBar PROMPT "Center"     CENTER ACTION ( oImage:Center(),    oImage:SetFocus() )
   DEFINE BUTTON OF oWnd:oBar PROMPT "Fit Width"  CENTER ACTION ( oImage:FitWidth(),  oImage:SetFocus() )
   DEFINE BUTTON OF oWnd:oBar PROMPT "Fit Height" CENTER ACTION ( oImage:FitHeight(), oImage:SetFocus() )
   DEFINE BUTTON OF oWnd:oBar PROMPT "Fit Rect"   CENTER ACTION ( oImage:FitRect(),   oImage:SetFocus() )
   DEFINE BUTTON OF oWnd:oBar PROMPT "Zoom"       CENTER ACTION ( MsgInfo( "Zoom/Unzoom with Mouse Wheel" ),  oImage:SetFocus() )
   DEFINE BUTTON OF oWnd:oBar PROMPT "Pan/Move"   CENTER ACTION ( MsgInfo( "Drag with Mouse" ),  oImage:SetFocus() )

   @ oWnd:oBar:nHeight,0 XBROWSE oBrw SIZE 250,-oWnd:oMsgBar:nHeight ;
      PIXEL OF oWnd DATASOURCE oDevice:aMeta COLUMNS 1 ;
      HEADERS "ThumbNail" LINES NOBORDER

   WITH OBJECT oBrw
      :aCols[ 1 ]:cDataType   := "F"
      :aCols[ 1 ]:nWidth      := 300
      :nRowHeight             := 200
      :lHScroll               := .f.
      :bChange                := { || oImage:Refresh() }
      //
      :CreateFromCode()
   END

   @ oWnd:oBar:nHeight,oBrw:nWidth XIMAGE oImage SIZE 0,-oWnd:oMsgBar:nHeight ;
      OF oWnd SOURCE oBrw:aRow

   oImage:SetBrush( oBrush )

   ACTIVATE WINDOW oWnd MAXIMIZED VALID ( lExit := .t. )

   StopUntil( { || lExit } )

   RELEASE FONT oFont
   RELEASE BRUSH oBrush

return nil

//----------------------------------------------------------------------------//
Regards



G. N. Rao.

Hyderabad, India

Continue the discussion