Losing popup-menu assigned to a button

Posted by jquerijero on 23-Oct-2017 09:40

I have button with a popup-menu attached to it that displays when you click on the button. The popup-menu could be recreated and reassigned to the button several times during the course of using the form. After opening another .w from one of the popup-menu item trigger then closing the newly open .w, which will trigger the popup-menu recreation and reassignment to the button, the popup-menu doesn't display anymore. The odd thing is that it only happens when I click on one specific button of the newly opened window. The button's POPUP-MENU handle is valid when the newly opened window is closed, but the popup-menu will not display. Forcing a reassignment of the POPUP-MENU handle doesn't seem to fix the issue.

Any ideas what is going on?

All Replies

Posted by Matt Gilarde on 23-Oct-2017 09:57

You used the term "form". Does the application use GUI for .NET or is it all ABL widgets?

Do other actions work correctly when the menu won't display? For example, do triggers run when you click on other buttons when the problem is happening?

Posted by jquerijero on 23-Oct-2017 10:30


Yes, other buttons except the one with a POPUP-MENU work as expected.

Posted by Matt Gilarde on 23-Oct-2017 10:33

Is there any chance you can create a small reproducible example?

Posted by Patrick Tingen on 23-Oct-2017 13:22

Have you tried walking through the code with the Debugger? Often you can get a good idea what is going wrong where.

Posted by jquerijero on 23-Oct-2017 15:04

I did. I am using a global variable for the POPUP-MENU handle. What I noticed is that the handle becomes invalid (although it still points to something, meaning not ?) right after the newly opened window closes.

Call goes like this;

1. POPUP-MENU trigger

2. Open a new window

3. Click the "unlucky" button inside the newly opened window, which triggers a recreation of the POPUP-MENU that is currently running the trigger and ghPopUpmenuHandle is updated with the value of the handle. (Note that other buttons on the window that can also recreate the POPUP-MENU don't display the same problem.)

4. Close the newly opened window (using X or a defined Close button)

5. Inspect the global handle (ghPopUpmenuHandle) from the calling window inside WINDOW-CLOSE of the new window

--- RUN InspectHandle(OUTPUT hHandle) IN callingWin.   ----- at this point the handle is valid

6. Control goes back to the calling window

7. Display a message right immediately after RUN xxxx.w

--- MESSAGE VALID-HANDLE(ghPopUpmenuHandle) VIEW-AS ALERT-BOX. ---- at this point the handle is invalid but not ?

This thread is closed