Hi Colin,
* This was plan 1. Please see plan 2 below.
Thank you for the references. I am trying to create a custom report previewer form with navigation and print buttons right on it, based on an example in Solution Samples.
The following code in form.init and one of the methods has two problems:
1) As the form is maximized and the PreviewContainer shape along with it (this is done by the framework I use) it causes the aspect ratio of the report to change. How can you know the report proportions in order to increase the size without distortion?
2) The process is quite slow for even for a three page report. Can something be done to speed it up? At the moment I am running a lose project, not an app or exe.
* Form.Init()
LPARAMETERS toParentForm
IF NOT DODEFAULT()
RETURN .F.
ENDIF
This.oParentForm = toParentForm
This.AddProperty('cReportFile',toParentForm.Rpttmpfile)
This.AddProperty('oListener',.NULL.)
Thisform.WindowState = 2
This.AddProperty('cReportBehavior',SET('ReportBehavior'))
SET REPORTBEHAVIOR 90
This.Previewreport()
* Form.PreviewReport()
#DEFINE LISTENER_TYPE_ALLPGS 3
#DEFINE LISTENER_DEVICE_TYPE_CTL 2
LOCAL lcReport
WITH Thisform
WAIT WINDOW NOWAIT 'One moment, please...'
lcReport = .oParentForm.Rpttmpfile
IF VARTYPE(.oListener) = 'O'
.oListener.OnPreviewClose()
ENDIF
.oListener = CREATEOBJECT('ReportListener')
.oListener.ListenerType = LISTENER_TYPE_ALLPGS
report form (lcReport) object .oListener
.pagina_cantidad = .oListener.PageTotal
.oListener.OutputPage(1,.oPreviewContainer,LISTENER_DEVICE_TYPE_CTL)
.Refresh()
ENDWITH
* Plan 2
After unpacking frxpreview.vcx and listener.vcx I see another possibility, coupled with an ExtensionHandler as you suggest.
1) Create an ExtensionHandler with an InitializeToolbar method, where controls are added to the toolbar to allow user to select a page range.
2) The ExtensionHandler should also include a Release method which will be called as the Preview form is released. If user selected a page range and clicked on print, in the ExtensionHandler.Release() method add two properties to Listener.CommandClauses: RangeForm and RangeTo with appropriate values. The Listener should take care of the rest.
Did I understand correctly the behavior, and is this a reasonable strategy?
Thank you very much.
Alex