RP2SQL32Lib

Deutschsprachiges X#-Forum – German language forum

Moderator: wriedmann

User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

RP2SQL32Lib

Post 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?
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
lagraf
Posts: 450
Joined: Thu Jan 18, 2018 9:03 am
Location: A

RP2SQL32Lib

Post 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?
leighproman
Posts: 60
Joined: Tue Oct 11, 2016 8:56 pm
Location: UK

RP2SQL32Lib

Post by leighproman »

Are you using the RpReportEnded() callback method?

Code: Select all

METHOD RpReportEnded( oReport ) 

oReport:Close()
	
RETURN TRUE
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

RP2SQL32Lib

Post 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.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
lagraf
Posts: 450
Joined: Thu Jan 18, 2018 9:03 am
Location: A

RP2SQL32Lib

Post 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.
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

RP2SQL32Lib

Post 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.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
lagraf
Posts: 450
Joined: Thu Jan 18, 2018 9:03 am
Location: A

RP2SQL32Lib

Post by lagraf »

Thank you Chris!
lagraf
Posts: 450
Joined: Thu Jan 18, 2018 9:03 am
Location: A

RP2SQL32Lib

Post 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?
leighproman
Posts: 60
Joined: Tue Oct 11, 2016 8:56 pm
Location: UK

RP2SQL32Lib

Post 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
User avatar
Chris
Posts: 4906
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

RP2SQL32Lib

Post 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.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
Post Reply