Page 2 of 4
RP2SQL32Lib
Posted: Wed Feb 05, 2020 12:26 pm
by Chris
When this happened in my own app, it was because I was using a report:Close() after the Preview. This worked in VO because apparently the preview window was being shown modally, but in the .Net version this is not modal anymore, so the report closes directly. Could it be you are doing something similar?
RP2SQL32Lib
Posted: Wed Feb 05, 2020 5:32 pm
by lagraf
Hi Chris,
as the app was transported from VO the (modified) code is
Code: Select all
CLASS dlgReports INHERIT ...
METHOD pshOk()
...
oRpReport := RpReportSQL{SELF, GetDefault()+cReport+".RPT", GetDefault(), {}, "user", "pass"}
IF oRpReport:IsValid
oRpReport:PrintPreview(cReport,cReport+".PRN",cCaption,"Bericht in Bearbeitung...")
ENDIF
oRpReport:Close()
SELF:EndDialog()
RETURN SELF
To comment the oRpReport:Close() is not enough, you also have to comment the SELF:EndDIalog(), but then the window dlgReports is not closed, so you have to start the oRpReport:PrintPreview with SELF:Owner instead of SELF and leave the SELF:EndDialog() uncommented!
Is this the right way or is there a better way to do this, e.g. start Preview modeless?
RP2SQL32Lib
Posted: Wed Feb 05, 2020 7:58 pm
by leighproman
Are you using the RpReportEnded() callback method?
Code: Select all
METHOD RpReportEnded( oReport )
oReport:Close()
RETURN TRUE
RP2SQL32Lib
Posted: Wed Feb 05, 2020 11:13 pm
by Chris
Guys, I am looking into various RP2 problems right now, will also look into making the Preview Dialog modal (optionally?) as well, so it has the same behavior as in VO. We should have a new improved version soon.
RP2SQL32Lib
Posted: Thu Feb 06, 2020 6:48 am
by lagraf
The RpReportEnded method is exactly what I wanted!
I never used this method cause in VO the reports were modal so it wasn't needed!
Thanks!
Chris: I'm waiting for your next version of ReportPro, take your time!
Meanwhile I'm testing one of my apps with X# and to do this I also have ReportPro calls (in Vulcan style) up and running.
RP2SQL32Lib
Posted: Thu Feb 06, 2020 7:48 am
by Chris
Franz,
While looking at some other issues, I realized that there's a parameter (the 5th one) in PrintPreview() named "lModal". So if you pass the method TRUE as a fifth argument, the preview window should be modal as in VO. This is now also TRUE by default in our internal build.
RP2SQL32Lib
Posted: Thu Feb 06, 2020 7:58 am
by lagraf
Thank you Chris!
RP2SQL32Lib
Posted: Tue Feb 11, 2020 1:07 pm
by lagraf
I got another problem with Report Pro, when I do a manual report with RpPrinter
Code: Select all
oPrinter := RpPrinter{oWindow, SELF}
oPrinter:PrintPreview("Job","File", "Caption", "Message", TRUE, FALSE, FALSE)
3 params are missing, so I changed it to
Code: Select all
oPrinter:PrintPreview("Job", "File", "Caption", "Message", TRUE, FALSE, FALSE, SW_NORMAL,1,NULL_SYMBOL)
Which values can I use for nZoom?
What means param symPPWindow? If I give NULL_SYMBOL report crashes?
RP2SQL32Lib
Posted: Tue Feb 11, 2020 1:56 pm
by leighproman
From the RP2 help file:
nZoomed
Optional parameter which specifies the initial zoom level of the Print Preview window. Valid options are:ZOOM_WHOLE_PAGE, ZOOM_PAGE_WIDTH and ZOOM_100
symPPWindow
Optional parameter to specify a symbol representing a class to instantiate for use as the Print Preview window. The class specified must provide certain callback methods for ReportPro. The code for ReportPro's PrintPreview windows is provided as an example of what methods the window needs to provide.
There are two Print Preview window types provided with ReportPro:
#rpPrintPreviewMDI: this symbol will produce a Print Preview window that is built on an MDI child window. The owner must be an MDI shell type window.
#rpPrintPreviewDLG: this symbol will produce a Print Preview window that is built on a modal or modeless dialog window.
For zoom:
Code: Select all
DEFINE ZOOM_WHOLE_PAGE :=0
DEFINE ZOOM_PAGE_WIDTH :=1
DEFINE ZOOM_100 :=2
For the window symbol we use #PreviewDlg with the following class:
Code: Select all
CLASS PreviewDlg INHERIT ReportPro2.rpPrintPreviewDlg
METHOD Init(oParent,oPrinter,cCaption,lModal,ptrPlacement,nShowState,lLandScape,nZoom)
SUPER:Init(oParent,oPrinter,cCaption,lModal,ptrPlacement,nShowState,lLandScape,nZoom)
SELF:Caption := cCaption
// here you can delete the default buttons
// and add yours
RETURN SELF
END CLASS
Leigh
RP2SQL32Lib
Posted: Tue Feb 11, 2020 2:22 pm
by Chris
Guys,
With our latest changes in RP2, all the parameters in PrintPreview() are now optional, so you will not have to bother about it anymore. Regarding the symPPWindow parameter, NULL_SYMBOL should be fine, when this is passed (and is the default now), RP2 uses its standard preview dialog.