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:

  • Please see this ... community.microfocus.com/.../2590.aspx

  • 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

  • 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.

  • 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.

  • 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.