Welcome, Guest
Username: Password: Remember me
This forum is the place to discuss issues related to ReportPro, Xs2Ado, Vo2Ado, bBrowser and other 3rd party products
  • Page:
  • 1

TOPIC:

ReportPro3 RpPrinter window class 07 Oct 2022 05:21 #24116

  • JohnBonnett88
  • JohnBonnett88's Avatar
  • Topic Author


  • Posts: 34
  • 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

    Please Log in or Create an account to join the conversation.

    ReportPro3 RpPrinter window class 07 Oct 2022 07:12 #24117

    • Chris
    • Chris's Avatar


  • Posts: 3750
  • 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.
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    ReportPro3 RpPrinter window class 11 Oct 2022 02:52 #24128

    • JohnBonnett88
    • JohnBonnett88's Avatar
    • Topic Author


  • Posts: 34
  • 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

    Please Log in or Create an account to join the conversation.

    ReportPro3 RpPrinter window class 11 Oct 2022 17:33 #24141

    • Chris
    • Chris's Avatar


  • Posts: 3750
  • 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!
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    ReportPro3 RpPrinter window class 19 Oct 2022 02:01 #24211

    • JohnBonnett88
    • JohnBonnett88's Avatar
    • Topic Author


  • Posts: 34
  • 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

    Please Log in or Create an account to join the conversation.

    ReportPro3 RpPrinter window class 19 Oct 2022 07:23 #24215

    • Chris
    • Chris's Avatar


  • Posts: 3750
  • Thanks John, indeed that might be helpful to others as well!
    XSharp Development Team
    chris(at)xsharp.eu

    Please Log in or Create an account to join the conversation.

    • Page:
    • 1