Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
#DEFINE PrintFromPreview .F.
LOCAL loPreviewContainer AS FORM, ;
loReportListener AS REPORTLISTENER, ;
loExHandler AS ExtensionHandler OF SYS(16)
loPreviewContainer = NULL
DO (_REPORTPREVIEW) WITH loPreviewContainer
loReportListener = NEWOBJECT('ReportListener')
loReportListener.LISTENERTYPE = 1 &&Preview
loReportListener.PREVIEWCONTAINER = loPreviewContainer
loPreviewContainer.AllowPrintfromPreview = PrintFromPreview
loPreviewContainer.TextOnToolbar = .F.
loExHandler = NEWOBJECT('ExtensionHandler')
loPreviewContainer.SetExtensionHandler( loExHandler )
REPORT FORM MYFORM PREVIEW NOCONSOLE FOR FIELDNAME="whatever" OBJECT loReportListener
DEFINE CLASS ExtensionHandler AS CUSTOM
*-- Ref to the Preview Container's Preview Form
PreviewForm = NULL
*-- Here you implement (hook into) the PreviewForm_Assign
*-- event of the preview container's parent proxy
PROCEDURE PreviewForm_Assign( loRef )
*-- Perform default behavior: assign obj ref.
THIS.PreviewForm = loRef
*-- Grab the obj ref to the preview form and bind to its
*-- ShowToolbar() method. This lets the
*-- STB_Handler() method of this extension handler
*-- to run code whenever the Preview toolbar is shown
*-- by the PreviewForm.ShowToolbar() method.
IF !ISNULL( loRef )
BINDEVENT(THIS.PreviewForm, ;
'ShowToolbar', THIS, 'STB_Handler')
ENDIF
ENDPROC
PROCEDURE STB_Handler(lEnabled)
*-- Here you work around the setting
*-- persistence problem in the Preview toolbar.
*-- The Preview toolbar class (frxpreviewtoolbar)
*-- already has code that you can use to enforce
*-- setting's persistence; it is just not called. Here,
*-- you call it.
WITH THIS.PreviewForm.TOOLBAR
.REFRESH()
*-- When you call frxpreviewtoolbar::REFRESH(), the
*-- toolbar caption is set to its Preview form,
*-- which differs from typical behavior. You must revert that
*-- to be consistent. If you did not do this,
*-- you would see " - Page 2" appended to the toolbar
*-- caption if you skipped pages.
.CAPTION = THIS.PreviewForm.formCaption
ENDWITH
ENDPROC
*-- A preview container requires these methods
*-- to be implemented in an associated preview extension handler.
*-- They are not used in this example, but still must be here.
PROCEDURE AddBarsToMenu( cPopup, iNextBar )
PROCEDURE SHOW( iStyle )
ENDPROC
PROCEDURE HandledKeyPress( nKeyCode, nShiftAltCtrl )
RETURN .F.
ENDPROC
PROCEDURE PAINT
ENDPROC
PROCEDURE RELEASE
RETURN .T.
ENDPROC
ENDDEFINE
The recommended mode - make it simple !!!
from now on, I'm recommending people to use only the simplified mode:
Code:DO FoxyPreviewer.app REPORT FORM YourReport PREVIEW