Highlighted
Absent Member.
Absent Member.
1944 views

[archive] unexpected EVENT-TYPE value

[Migrated content. Thread originally posted on 25 September 2007]

I've got a COM object with a method that invokes a user interface. This is not ActiveX, the object controls the interface. When I invoke the method, I want my Cobol program to essentially stop and do nothing other than listen for events from the object. I'm using a simple PERFORM loop to "wait" while it's listening for and processing events. However, when I execute it the program never responds to any of the events.

Using the AcuCobol-GT Debugger I can see that when I perform actions in the COM object's interface that should trigger events, it does break back into the event procedure defined for the object. However, the EVENT-TYPE value doesn't indicate that the event is an ActiveX event, so the program ignores it. When the event procedure is triggered both EVENT-TYPE and EVENT-TYPE-2 contain the value 538976288. As a result, none of the events are being processed. Has anyone experienced anything like this before?

I've attached a small sample program & accompanying .DEF file. Hopefully I'm missing something really obvious...

Thanks!
Laura
0 Likes
6 Replies
Highlighted
Absent Member.
Absent Member.

RE: [archive] unexpected EVENT-TYPE value

You do not state which version you use, but COM events were not fully supported in ACUCOBOL-GT until version 7.0.0.

If you use 7.0.0 or later, you will have to send your case to technical support for assistance as this is not a generic module.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] unexpected EVENT-TYPE value

I'm using AcuCobol-GT version 7.0.1, and I have requested assistance from technical support. But typically there's a minimum 24 hour wait for an answer from that group, and I was hoping someone on the forum might already know the answer so I could keep moving on this project.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] unexpected EVENT-TYPE value

Your code looks for
if event-type = msg-ax-event

what if the event is not coming from the ActiveX control?

Can you post the control (do you need a license to run it)?
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] unexpected EVENT-TYPE value

I'm posting the solution to this issue in case anyone else has a similar problem, since AcuCorp support was of no help whatsoever. They said, "I already talk to some of my colleagues but unfortunately we do not have a quick answer and we will need to look more deeply into the object, something that is out of the scope of technical support. ... see if we can help you through our Professional Services Department." Professional Services said my problem was most likely due to a defect in the object and offered to assist for a fee. When I finally figured out what I was doing wrong, I was steamed that everyone assumed it must be a problem with the object. Clearly no one even looked at the sample code I sent. I was missing something really obvious.

Since the UI is being handled entirely by the COM object, my program had no ACCEPT statement. I changed my PERFORM loop to include an 'ACCEPT EVENT BEFORE TIME x' and that solved the problem I was having receiving events from the object.

The only problem I have now is that the AcuCobol-GT debugger doesn't work properly while the ACCEPT EVENT statement is in effect. As soon as the 'ACCEPT EVENT' command is executed the debugger seems to think each keystroke is followed by an key. Frustrating, but I can at least use the drop menus at the top of the debugger window to do most everything; only the Data > Accept function is not usable. Does anyone know how to resolve this? Do I need to terminate the ACCEPT EVENT statement while events are being handled? How can I do that without impacting my ability to receive events from the COM object?


           create ProvidexBar handle in mms-menu
                  event procedure menu-events.
           modify mms-menu @ShowMMSMenu().
           perform until close-menu = "Y"
               accept event before time 500    | 5 second timeout
           end-perform.
           destroy mms-menu.
           stop run.

       menu-events.
           if event-type = msg-ax-event
             evaluate event-data-2
                when ProvidexBarToolOpenClick
                    inquire mms-menu @MenuItemKey in selection-id
                    display message box
                       "Menu item selected: ", selection-id
                when ProvidexBarMMSMenuClosed
                when ProvidexBarMMSMenuLogout
                    move "Y" to close-menu
             end-evaluate.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] unexpected EVENT-TYPE value

I've experienced the same behavior in the debugger and don't know of a way around it. I do as you do and use the menus.
0 Likes
Highlighted
Absent Member.
Absent Member.

RE: [archive] unexpected EVENT-TYPE value

You can circumvent this to an extent if you set a flag when you are inside the event. e.g.

WORKING-STORAGE...
77 EventIsBusy PIC 9 VALUE 0.
...
MyEventProc.
     IF EventIsBusy = 1
       MOVE EVENT-ACTION-IGNORE TO EVENT-ACTION
       EXIT PARAGRAPH
       END-IF
     MOVE 1 TO EventIsBusy
   *Do your stuff...
     MOVE 0 TO EventIsBusy
     EXIT PARAGRAPH.
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.