Question Is it possible to trigger a popup-menu

Hello guys,

I'm back with another question.
Is it possible to open a popup-menu without a right click on a widget?
To be more precised, I have a main windows and don't have her source code. But I'm able to add a buton and to launch a procedure by this button.
In this procedure (that you will found bellow), I create a popup menu that I give to the Frame of the main window.
This work.
But after that I'm not able to display the popup menu by code. I can display it by right-clicking on the frame.

There is my procedure:
Code:
/* creation nouveau menu */
DEFINE VARIABLE mother AS HANDLE      NO-UNDO.
DEFINE VARIABLE maFrame AS HANDLE      NO-UNDO.
DEFINE VARIABLE monObjet AS HANDLE      NO-UNDO.
DEFINE VARIABLE hMenuP AS HANDLE      NO-UNDO.
DEFINE VARIABLE hItemP AS HANDLE      NO-UNDO.
DEFINE VARIABLE hSess AS HANDLE      NO-UNDO.
DEFINE VARIABLE k AS INTEGER     NO-UNDO.
    CREATE MENU hMenuP ASSIGN
        FONT       = 3
        POPUP-ONLY = TRUE
        FONT       = 2 .

    DO k = 1 TO 3:
        CREATE MENU-ITEM hItemP ASSIGN
            SUBTYPE = "normal":u
            PARENT  = hmenuP
            LABEL   = STRING(k)
            SENSITIVE = FALSE .

    END.

    hSess = SESSION:FIRST-CHILD .

    DO WHILE VALID-HANDLE(hSess):
        IF hSess:TITLE MATCHES "*(wacfam01)*" THEN DO:
            
            LEAVE.
        END.
        hSess = hSess:NEXT-SIBLING.
    END.

    /*mother = this-procedure:INSTANTIATING-PROCEDURE .
    mother = mother:INSTANTIATING-PROCEDURE.
    MESSAGE mother:NAME SKIP
            mother:TYPE
        VIEW-AS ALERT-BOX INFO BUTTONS OK. */
    maFrame = hSess:FIRST-CHILD.
    maFrame = maFrame:FIRST-CHILD.

    monObjet = maFrame:FIRST-CHILD.

    DO WHILE VALID-HANDLE(monObjet) .
        IF monObjet:NAME = "F-Main" THEN
            LEAVE.
        monObjet = monObjet:NEXT-SIBLING .
    END.

    monObjet:POPUP-MENU = hmenup.
    
    APPLY 'RIGHT-MOUSE-CLICK' TO monObjet .

Thanks in advance and best regards
 
thank you @Osborne. I might use this trick.

I foud another way to do what I was needed. But I will continue to look on that.

If I were able to generate the popup-menu at the start of the main window, it wouldn't be an issue, but i'm not so show must go on :)
 
Top