ReportPro3 RpPrinter window class

This forum is the place to discuss issues related to ReportPro, Xs2Ado, Vo2Ado, bBrowser and other 3rd party products
Post Reply
JohnBonnett88
Posts: 45
Joined: Mon Mar 07, 2022 12:34 am

ReportPro3 RpPrinter window class

Post by JohnBonnett88 »

Hi All,
I have inherited a reasonably large VO codebase and have been converting it to X#. Things have been going well. and much of it is working as expected. I am now at the point of getting the reports working. We have got a license for RP3 from the XSharp site but it seems the code was designed to work with RP2. I am in the process of trying to get it working with RP3. I have created some extension methods that have got things to the state of building OK but running reports has a problem. The reports all seem to be generated from code, and not using any .RPT files.

Here is my current state. In setting up a report, I get to a line like this:
oPrinter := RpPrinter{SELF, oRpt}

where it is creating an RpPrinter object. A little further into this, I get this error

Unable to cast object of type 'ClientsReports' to type 'Classmate.cWindow'.

this is coming from that SELF parameter passed to the constructor. It is a window, but not the right type of window. SELF is of type ClientsReport which has an inheritance hierarchy like this:

ClientsReports
LabEditWindow
VO.DATAWINDOW
VO.ChildAppWindow
VO.AppWindow
VO.Window
VO.EventContext
XSharp.VObject

Digging through the documentation I find that the first parameter needs to be inherited from Classmate.cWindow, hence the problem with the cast. I suspect I will have this same issue with most of the other reports. My first thought is perhaps I need to create a cWindow wrapper around the VO.Window but perhaps there are other solutions. Perhaps we should have got RP2?

Any suggestions about how I should proceed from here?

Best Regards,
John
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

ReportPro3 RpPrinter window class

Post by Chris »

HI John,

Yes indeed, RP3 is much different in design to RP2, so if your VO code is using RP2, then that's what you should get for X# as well.
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
JohnBonnett88
Posts: 45
Joined: Mon Mar 07, 2022 12:34 am

ReportPro3 RpPrinter window class

Post by JohnBonnett88 »

Thanks Chris,
While waiting for a reply, I did some more hunting and saw you gave this same advice to someone else about 20 years ago!
We will chase up getting V2 in place of the V3 we have.
Thanks again,
John
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

ReportPro3 RpPrinter window class

Post by Chris »

Hi John,

Hehe, that's nice, I'm glad my advice has stood the test of time :)
I assume it must had been a post in the comp.lang.clipper.visual-objects newsgroup..
You're welcome!
Chris Pyrgas

XSharp Development Team test
chris(at)xsharp.eu
JohnBonnett88
Posts: 45
Joined: Mon Mar 07, 2022 12:34 am

ReportPro3 RpPrinter window class

Post by JohnBonnett88 »

Hi Chris,
You are right, I think it was that Clipper forum. I remember when Clipper was a thing but never used it.

I should let you know, I seem to have got everything working with ReportPro2, but I did have a little problem, which was nothing to do with ReportPro, that prevented me from previewing a report. In case it helps someone else, here is a brief description.

Previewing failed with a message that I had provided a null delegate in the CLR. After debugging down into the ReportPro runtime I discovered the null delegate was in a variable called delrpEnumMetaFileDelegate which is the delegate for the routine that is to paint the contents of the graphics metafile on the screen when the report has been generated. The variable should have been assigned a value in
PROCEDURE _InitRp2 _INIT3 of the ReportPro2 runtime, but the code never got executed in my debugging session. On reading up about what _INIT3 meant, I discovered what was happening.

My particular app starts with a shell application that lets you fire up other subsystems contained in class libraries (DLLs). One of those subsystems does the reporting and is the first to access the ReportPro DLLs. It looks like, when a DLL is first invoked from another DLL, the initialization procedures are not run. The fix was easy, I just added a reference to the ReportPro DLLs into the shell application, even though it does not use those DLLs. The DLLs got initialized and reporting now works!

Having access to code for ReportPro and the X# runtime helped me track down what was going on.

Best Regards,
John
User avatar
Chris
Posts: 4562
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

ReportPro3 RpPrinter window class

Post by Chris »

Thanks John, indeed that might be helpful to others as well!
Chris Pyrgas

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