Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
andreaforlin Absent Member.
Absent Member.
2761 views

Again Custom .NET UserControl - event handling

Again with my custom control in .NET ... well the event are fired and catched from my "event procedure" and all is wrapped from an accept screen..

      ShowGrid.
           modify net-grid "@ShowGrid"().
           set exit-now to false.
           perform until Exit-Pushed
             accept screen-1 
               on exception perform Acu-Screen1-Evaluate-Func
             end-accept
           end-perform.
           .

But the problem is when I need to close the form from the .NET event procedure. How to break the accept and go to exception handling? I've tried to call the exit program but from an event procedure is ignored.

The manual say to force EVENT-ACTION-FAIL to EVENT-ACTION variable but don't work.

Any suggestion?

Thanks

Andrea

Tags (1)
0 Likes
5 Replies
Micro Focus Expert
Micro Focus Expert

RE: Again Custom .NET UserControl - event handling

0 Likes
andreaforlin Absent Member.
Absent Member.

RE: Again Custom .NET UserControl - event handling

Try to post an example www.dropbox.com/.../sampleprogram.zip

I've made a simple control with a button that fire an event and a customcontrol.cbl that handle it. But even if i move event-action-fail-terminate to event-action not stop the accept loop.

Some help?

Thanks

Andrea

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Again Custom .NET UserControl - event handling

How about using a before time

           accept screen-1

              before time 9000

              on exception perform Acu-Screen1-Evaluate-Func

            end-accept

You can use the config variable RENEW_TIMEOUT ... when a time out occurs you get a 99 in your exception value data item.

0 Likes
andreaforlin Absent Member.
Absent Member.

RE: Again Custom .NET UserControl - event handling

the before solution don't work, seem the timeout doesn't fire while the focus is on the .net control. I can click on the .net button get the event but no timeout. The timeout is fired when I tab from the "Exit" button, a strange behaviour.

this is the code

PERFORM UNTIL Exit-Pushed

              ACCEPT screen-1

before time 100

ON EXCEPTION

PERFORM Acu-Screen1-Evaluate-Func

              END-ACCEPT

  stop "end accept"

           END-PERFORM.

0 Likes
Micro Focus Expert
Micro Focus Expert

RE: Again Custom .NET UserControl - event handling

Customer Care passed along your example. Your example did not have an enter-able field, this is why the timeout did not work. There must be an enter-able field for the timeout to fire. I'm going to anticipate that you may want an alternative to the timeout .. I would suggest looking at threads and threads / messages.

community.microfocus.com/.../9071.aspx

You could put the .Net program in as a callable program and call it in a thread, when the .Net control is activated a message is sent. Then the main program can see if the called program sends back a message. the main program can then basically set up a timer and if the called program does not end or message back in a certain amount of time, the main program can cancel the called program.

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.