We have migrated the underlying structure of our Menu Tools from the textual representation of a menu to an array-based representation we call a menu array (mArray).
We can use the following code to generate a menu array:
put the menu_Array of mController into mArray
A menu-array can then be turned into Menu Text using the following code:
put mArray_ToText (mArray) into mText
We can then:
set the text of menuButton to mText
to implement a menu (typically withing a mousedown handler:
on mousedown put the menu_Array of me into mArray put mArray_ToText (mArray) into mText set the text of me to mText end menu_Text
# Dynamic vs Static Menus can be static or dynamic. To achieve a dynamic menu the text of the menu-button must be set immediately before the menu is drawn. This is typically done (as above) in a mousedown handler where we fetch the menu_Array of mButton.
The code in the menu_Array handler will inspect the state of various aspects of the application and set the variable mArray to be checked, disabled or otherwise formatted in how it is displayed.
Alternatively if your menu does not require context depndent dynamic behavior, we can use static menus simply by storing the mArray or using (and not changing) the text of the menu-button.