Highlighted
Absent Member.
Absent Member.
1306 views

[archive] ActiveX Events

[Migrated content. Thread originally posted on 14 January 2005]

About C$GETEVENTPARAM

Hello,

I?m trying to manage the parameters returned by an event fired in the crystal reports ActiveX viewer, but unsuccessfully I can say.

The DEF file of the ActiveX control shows the parameters of the event:


* Clicked
         EVENT, 418, @CrystalActiveXReportViewerClicked
*            4 Parameters
*                "long x"
*                "long y"
*                [b]"VARIANT* EventInfo"[/b]
*                "boolean* UseDefault"


As you can see, the third parameter returns a Variant Type that points to an Object (@CRVEventInfo Object) which I need to process.

What I'm doing is to use "C$GETEVENTPARAM" routine to obtain the values:


...

[b]77  H-EVENTINFO       HANDLE OF @CRVEventInfo.[/b]
77  X-VALUE           PIC 9(05).
77  Y-VALUE           PIC 9(05).
77  RESULT            PIC S9(01).

...

EVALUATE EVENT-DATA-2
   WHEN @CrystalActiveXReportViewerClicked
        CALL "C$GETEVENTPARAM" USING
             EVENT-CONTROL-HANDLE "x"          X-VALUE
        CALL "C$GETEVENTPARAM" USING
             EVENT-CONTROL-HANDLE "y"          Y-VALUE
        [B]CALL "C$GETEVENTPARAM" USING
             EVENT-CONTROL-HANDLE "EventInfo"  H-EVENTINFO[/B]
        CALL "C$GETEVENTPARAM" USING
             EVENT-CONTROL-HANDLE "UseDefault" RESULT

...



All parameters, except H-EVENTINFO, are properly returned. H-EVENTINFO is always Zero. The problem could be the conversion performed by C$GETEVENTPARAM and C$GETEVENTDATA but I'm unsure about this.

Can someone switch on the bulb ?

Regards.
0 Likes
5 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] ActiveX Events

I use C$GETEVENTDATA on similar events and it works ok. I've not used C$GETEVENTPARAM. What version of the runtime are you using? Also, I've learned from the past that it's a good idea to initialize the fields before calling C$GETEVENTDATA.

Haven't had this specific experience before.

Rob
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] ActiveX Events

Originally posted by Robstan
I use C$GETEVENTDATA on similar events and it works ok. I've not used C$GETEVENTPARAM.


I've used both C$GETEVENTDATA and C$GETEVENTPARAM with identical results. Anyway C$GETEVENTPARAM allows access to a single parameter and also makes a more readable code.

Originally posted by Robstan
What version of the runtime are you using?


6.2 (impatient until version 7 beta appears).

Originally posted by Robstan
Also, I've learned from the past that it's a good idea to initialize the fields before calling C$GETEVENTDATA.


Also I've tried to first initialize the fields without success.

Thanks.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] ActiveX Events

Note that EventInfo is wrapped by a variant. May I suggest you return this value into a USAGE VARIANT and then try to use C$GETVARIANT to get the handle to EventInfo.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] ActiveX Events

I've already tried this:


...
77  H-VARIANT         HANDLE OF VARIANT.
77  H-EVENTINFO       HANDLE OF @CRVEventInfo.
...
CALL "C$GETEVENTPARAM" USING
             EVENT-CONTROL-HANDLE "EventInfo"  H-VARIANT

CALL "C$GETVARIANT USING
          H-VARIANT H-EVENTINFO


but what I'm getting is an error message:

Invalid or missing parameter to "C$GETVARIANT"

What do you think ?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] ActiveX Events

In the previous example, seems like "C$GETVARIANT" is failing due to H-VARIANT is null. In fact, if I code this way:

IF H-VARIANT NOT = NULL
   CALL "C$GETVARIANT USING
        H-VARIANT H-EVENTINFO
END-IF

no error occurs.

Now the question is: Is Crystal returning mistakely the "EventInfo" Variant or is "C$GETEVENTPARAM" failing to get it ?

Here is the coding in VB (that works) for the Cliked Event:


Private Sub CrystalViewer1_Clicked(ByVal x As Long, ByVal y As Long, EventInfo As Variant, UseDefault As Boolean)

'Create an object that traps the CRViewer event info.
Dim CrViewerEventInfo As CrystalActiveXReportViewerLib10Ctl.CRVEventInfo

'Pass the EventInfo info to the CrVEventInfo object.
Set CrViewerEventInfo = EventInfo

'If the event text is not empty then display it in a Message Box.
If Not CrViewerEventInfo.Text = "" Then
   MsgBox CrViewerEventInfo.Text
End If

End Sub


I hope this make things more clear.
Regards.
0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.