Difference between revisions of "SCI Kernel Documentation/Menu Functions"
Line 85: | Line 85: | ||
<blockquote> | <blockquote> | ||
{| | {| | ||
− | | width= " | + | | width= "200" |#p_said: newSaidSpec||change the said spec for the menu item |
|- | |- | ||
|#p_text: newText||change the text displayed in the menu | |#p_text: newText||change the text displayed in the menu |
Revision as of 13:53, 3 December 2015
Menu Functions
The menu bar is the line at the top of the screen which contains the names of each of the menus. A menu is the drop-down list of menu items which can be selected.
Draw the menu bar represented by the kList menuList on the top line of the screen in the system font (font 0).
Drop down the first (leftmost) menu in the menu bar represented by menuList and let the user select an item from the menu bar using cursor keys. If the user presses ESC, return FALSE; if the user presses ENTER, return the object ID of the item selected.
(DrawStatus str [foreground [background]])
Replace the menu bar with a status line which consists of the string str. If str is 0, discard the status line, showing the menu bar once again. (Note that the user can still activate the menus by pressing the mouse button with the cursor on the status line or by pressing the menu selection key.) The foreground and background colors default to black on white. Note that these colors are indexes into the palette, so vRED is unlikely to be actually red (it will select the 4th element of the current palette).
Add a menu item that has menuTitle, which is a near string that contains the message that will be on the menu bar. menuSelections is a near string that contains the available items that will "drop down" if the menu is selected. The menuSelections is built by putting together the items, seperated by a ":" as follows -
{ <name1><functions>:<name2><functions>...}
The following functions are possible:
= sets a menu item's starting value ! makes the item non-selectable ` denotes the following character as the key for the menu
An example of the use of AddMenu is:
Code:(AddMenu { File } { Save Game`#5:--!:Restore Game`#6:Speed`^s=6} )
(SetMenu itemName selector value [selector value ...])
where itemName is the name by which you refer to your menu item and the the available selectors are
#p_said: newSaidSpec change the said spec for the menu item #p_text: newText change the text displayed in the menu #p_key: newKey change the key which selects the menu item #p_state: newState = dActive to enable menu item
= 0 to disable menu item#p_value: newValue change the value to return when selected
(GetMenu itemName selector)
Returns the current value of a menu item corresponding to the selectors listed above.
- Notes
< Previous: Input Functions Next: Window and Text Functions >