Creating triggers on dynamic toggle-box menu items

Posted by BeezBros on 02-Jan-2011 23:42

Hi there

I am hoping someone out there might be able to help me with this. I have been trying to get this to work for days with no success.

In my application, I am trying to support letting users create dynamic frames to store groups of shortcuts (sales VS production VS financials, etc) to their favourite menu items. I want the user to select the frame to display in the main window from a sub menu called "Shortcut Groups" under a main menu called of "Desktop" in the menu bar.

I am dynamically creating the frame without a problem.

I am dynamically creating the toggle box menu item in the sub menu without a problem.

The problem I am having is trying to create the trigger on the menu item to run the internal procedure that will display the appropriate frame for the shortcut group the user selects.

My code to create the menu item looks like this...

    create menu-item lh_MenuItem
        assign
            toggle-box = true
            name = "m_Shortcut_Groups_" + string(li_tmp,">>9")
            parent = menu m_Shortcut_Groups:handle in menu m_Desktop
            label = lc_Group
            private-data = "m_Shortcut_Groups_" + replace(lc_Group," ","-")
            sensitive = true
            triggers:
                on value-changed
                do:
                    message
                        "HERE" skip
                        program-name(1) skip
                        "value-changed"
                        view-as alert-box.

                    run DisplayDesktop in this-procedure.
                end.
            end triggers.

Notes:

lc_Group is the user nominated name they want the group to appear as in the list.

li_tmp represents the order in which the menu item will appear in the sub-menu.

This code compiles... it runs... it just doesn't do anything. When I select the dynamically created menu item, I would expect this to give me a message box stating "value-changed" and then run the program.

Any help would be appreciated.

Regards

Craig

All Replies

Posted by Admin on 03-Jan-2011 00:37

My code to create the menu item looks like this...

>            triggers:

>                on value-changed

>                do:

>                    message

>                        "HERE" skip

>                        program-name(1) skip

>                        "value-changed"

>                        view-as alert-box.

>                    run DisplayDesktop in this-procedure.

>                end.

>            end triggers.

>

it just doesn't do anything.

Try to modify the trigger like this:

ON VALUE-CHANGED PERSISTENT

RUN DisplayDesktop IN THIS-PROCEDURE .

Posted by BeezBros on 05-Jan-2011 22:27

Hi Mike

That worked a treat. I had misunderstood the meaning of persistent.

Thank you for your help.

Cheers

Craig

Posted by d.cook on 22-May-2011 21:39

Thanks you saved me from pulling the rest of my hair out!

This thread is closed