Difference between revisions of "SCI Kernel Documentation/Menu Functions"

From SCI Wiki
Jump to navigationJump to search
(Created page with "Official SCI Documentation<br /> <div align="center"> Chapter: 1 | 2 | SCI...")
 
 
(10 intermediate revisions by the same user not shown)
Line 10: Line 10:
 
[[SCI Kernel Documentation/String Functions|6]] |  
 
[[SCI Kernel Documentation/String Functions|6]] |  
 
[[SCI Kernel Documentation/Picture Functions|7]] |  
 
[[SCI Kernel Documentation/Picture Functions|7]] |  
[[SCI Kernel Documentation/Save/Restore Game Functions|8]] |  
+
[[SCI Kernel Documentation/Save-Restore Game Functions|8]] |  
 
[[SCI Kernel Documentation/Animation Functions|9]] |  
 
[[SCI Kernel Documentation/Animation Functions|9]] |  
 
[[SCI Kernel Documentation/Graphic Screen Functions|10]] |  
 
[[SCI Kernel Documentation/Graphic Screen Functions|10]] |  
Line 23: Line 23:
 
</div><br />
 
</div><br />
  
<div align="center"><span style="font-size: 22pt"></span><br />
+
<div align="center"><span style="font-size: 22pt">Menu Functions</span><br />
 
''Author: [[Jeff Stephenson]]''<br />
 
''Author: [[Jeff Stephenson]]''<br />
 
''Revision by: David Slayback''</div>
 
''Revision by: David Slayback''</div>
Line 29: Line 29:
 
&nbsp;
 
&nbsp;
  
xxxxxxx body xxxxxxxx
+
==<br /> 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.
 +
 
 +
===<br /> (DrawMenuBar menuList) ===
 +
 
 +
<blockquote>
 +
Draw the menu bar represented by the kList menuList on the top line of the screen in the system font (font 0).
 +
</blockquote>
 +
 
 +
===<br /> (MenuSelect menuList blocks) ===
 +
 
 +
<blockquote>
 +
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.
 +
</blockquote>
 +
 
 +
===<br /> (DrawStatus str [foreground [background]]) ===
 +
 
 +
<blockquote>
 +
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).
 +
</blockquote>
 +
 
 +
===<br /> (AddMenu menuTitle menuSelections) ===
 +
 
 +
<blockquote>
 +
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 -
 +
 
 +
<blockquote>{ &lt;name1&gt;&lt;functions&gt;:&lt;name2&gt;&lt;functions&gt;...}</blockquote>
 +
 
 +
The following functions are possible:
 +
 
 +
<blockquote>
 +
= sets a menu item's starting value
 +
! makes the item non-selectable
 +
` denotes the following character as the key for the menu
 +
</blockquote>
 +
 
 +
An example of the use of AddMenu is:
 +
 
 +
<blockquote><div class="CodeBlockHeader">Code:</div>
 +
<syntaxhighlight lang="sci">
 +
 
 +
(AddMenu { File }
 +
        { Save Game`#5:--!:Restore Game`#6:Speed`^s=6}
 +
)
 +
</syntaxhighlight>
 +
</blockquote>
 +
</blockquote>
 +
 
 +
===<br /> (SetMenu itemName selector value [selector value ...]) ===
 +
 
 +
<blockquote>
 +
where itemName is the name by which you refer to your menu item and the the available selectors are
 +
 
 +
<blockquote>
 +
{| valign="top"
 +
| width= "150" |#p_said: newSaidSpec||change the said spec for the menu item
 +
|- valign="top"
 +
|#p_text: newText||change the text displayed in the menu
 +
|- valign="top"
 +
|#p_key: newKey||change the key which selects the menu item
 +
|- valign="top"
 +
|#p_state: newState||= dActive to enable menu item<br />= 0 to disable menu item
 +
|-  valign="top"
 +
|#p_value: newValue||change the value to return when selected
 +
|}
 +
</blockquote>
 +
</blockquote>
 +
 
 +
===<br /> (GetMenu itemName selector) ===
 +
 
 +
<blockquote>
 +
Returns the current value of a menu item corresponding to the selectors  listed above.
 +
</blockquote>
  
 
&nbsp;
 
&nbsp;
Line 42: Line 115:
 
&nbsp;
 
&nbsp;
  
<span style="float: left">[[SCI Kernel Documentation/|&lt; Previous: ]]</span><span style="float: right">[[SCI Kernel Documentation/|Next: &gt;]]</span>
+
<span style="float: left">[[SCI Kernel Documentation/Input Functions|&lt; Previous: Input Functions]]</span>
 +
<span style="float: right">[[SCI Kernel Documentation/Window and Text Functions|Next: Window and Text Functions &gt;]]</span>
  
 
&nbsp;
 
&nbsp;
  
 
[[Category:SCI Documentation]]
 
[[Category:SCI Documentation]]
[[Category:Scripting]]
 
 
[[Category:Kernel Functions]]
 
[[Category:Kernel Functions]]
 +
[[Category:Menu]]
 +
[[Category:Menu Functions]]

Latest revision as of 13:56, 3 December 2015

Official SCI Documentation

Chapter: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Index


Menu Functions

Author: Jeff Stephenson

Revision by: David Slayback

 


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.


(DrawMenuBar menuList)

Draw the menu bar represented by the kList menuList on the top line of the screen in the system font (font 0).


(MenuSelect menuList blocks)

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).


(AddMenu menuTitle menuSelections)

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


 

Table of Contents

 

< Previous: Input Functions Next: Window and Text Functions >