Welcome to the SRP Forum! Please refer to the SRP Forum FAQ post if you have any questions regarding how the forum works.

Visible context menu on CLOSE causes crash

Hi all

This isn't an urgent one as its not terribly likely, but your help would be appreciated as always

A form has 2 buttons called BTN_TEST_CLOSE and BTN_TEST_CM. Below is the commuter - you will want to change the CLICK event to 'OnClick' for testing.

A cancel button is set in the create and also a context menu. If I run the form and press BTN_TEST_CM (to display the context menu) then with it still visible press ESC the form closes -> OI 9.3.1 crashes. It's only when pressing ESC that this happens, closing by any other way as a standalone form or a dialog all works fine.

At a guess the context menu component might not be being destroyed with the button perhaps?

Other scenarios I tried:
1. use post_event - this closes the window without a crash, however the contextmenu is still visible. Also post_event is not an option when using dialogs in a workflow heirarchy.
2. return 0 instead of 1 from commuter. Same as 1, except OI will crash after you click on a menu item.

Hope this helps, please let me know if you need anymore info.

compile function jb_test_events(focus, event, param1, param2, param3, param4, param5, param6, param7, param8, param9, param10, param11, param12, param13, param14, param15) * system $Insert logical declare function get_property declare subroutine set_property, send_message, send_event valid = true$ window = field(focus,'.',1) control = field(focus,'.',2) begin case // form-based events case control = '' begin case case event = 'CREATE' gosub create end case // control based events case control = 'BTN_TEST_CLOSE' if event = 'CLICK' then send_event(window, 'CLOSE') end end case return valid ** eof *****

create: set_property(window:'.BTN_TEST_CM', 'OLE.ContextMenu', 'test':@fm:'test2') Set_Property(window:'.BTN_TEST_CLOSE', 'OLE.Cancel', true$) return
User: James Birnie


  • Thanks for catching this and providing such a thorough explanation. It shouldn't be too hard to fix. I'll let you know when it's available.
Sign In or Register to comment.