 |
THE HYPERCARD CENTER |
|
|
Note: This is a work in progress and many formatting issues have been fixed. Read more about the project on the home page.
doMenudoMenu itemName [without dialog] ¬ [with keys] doMenu itemName, menuName ¬ [without dialog] [with keys]
The doMenu command performs the action specified by the item name and menu name just as if the user chose the item directly from the menu. without dialog bypasses the dialog box that would normally appear after the commands Delete Stack and Convert Stack, and, when a background field is selected, after Cut Field and Clear Field.
with keys chooses the named menu command with the shift, option, and/or Command keys pressed.
To determine from a script which keys were specified, look at param(6) of the original command. HyperCard sends the doMenu command as a message to the current card when the user selects a menu item. ItemName is the exact name of the menu item selected, and menuName is the exact name of the menu that contains the menu item. To handle the doMenu message, use this form: on doMenu theItem,theMenu statements end doMenu
Note: A doMenu handler can override a menuMessage . ExamplesdoMenu "Next" -- Add another Open Stack command: put "Open Stack..." after menu "Go" with menuMsg "beep" doMenu "Open Stack...", "Go" -- just beeps doMenu "Open Stack...", "File" -- does an open stack doMenu "Calculator" -- desk accessory from the Apple menu doMenu "Cut Field" without dialog -- with a bkgnd field selected doMenu "Open Stack..." with shiftKey -- checks "New Window" checkbox doMenu "Print Card" with shiftKey -- shows print dialog on doMenu theItem,theMenu if theItem is "Quit HyperCard" then answer "Bye!" with "Later" pass doMenu -- all doMenu messages, including the quit, are passed end doMenu
Demo Scripton mouseUp set cursor to watch doMenu "Background","Edit" -- view the background layer wait 45 doMenu "Background","Edit" -- return to the card layer end mouseUp
Related Topics Placeholders
itemNameA text expression that evaluates to the name of a menu item on one of HyperCard’s menus (or a menu created by the user). For example: "New Stack..." "Back" "Stack Info..."
menuNameA text expression that evaluates to the name of one of HyperCard’s menus or of a menu created by the user. For example: "File" "Edit" "Go" "MyMenu"
HyperTalk Reference
|