User Tools

Site Tools


howtos:toolcoding:user_interaction

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
howtos:toolcoding:user_interaction [2009/11/13 15:37]
deryn.crockett created
howtos:toolcoding:user_interaction [2013/09/12 20:16] (current)
deryn.crockett [Menu Command]
Line 8: Line 8:
 | [[user_interaction#​Mumble Command |mumble]] | mumble (expression1,​ expression2,​ ...) | displays strings, constants and TOOL variables on the screen but does not move the cursor to a new line | | [[user_interaction#​Mumble Command |mumble]] | mumble (expression1,​ expression2,​ ...) | displays strings, constants and TOOL variables on the screen but does not move the cursor to a new line |
 | [[user_interaction#​Menu Command |menu]] | menu (prompt, numItems, item1, ..., itemN, $choices[]) | displays a menu on the screen and allows a user to select items from the menu | | [[user_interaction#​Menu Command |menu]] | menu (prompt, numItems, item1, ..., itemN, $choices[]) | displays a menu on the screen and allows a user to select items from the menu |
- 
- 
 ===== Listen Command ===== ===== Listen Command =====
 The snytax of the listen command is: The snytax of the listen command is:
Line 20: Line 18:
  
 //TOOL variable// is the variable into which the entered data is placed. If this is an integer variable, only an integer value can be entered. If this is a boolean variable, the possible values that can be entered are {yes, y, true, 1} or {no, n, false, 0}.  These can also be entered as upper case letters. //TOOL variable// is the variable into which the entered data is placed. If this is an integer variable, only an integer value can be entered. If this is a boolean variable, the possible values that can be entered are {yes, y, true, 1} or {no, n, false, 0}.  These can also be entered as upper case letters.
 +==== Example ====
 +
 +Listen code example with a default option:
 +
 +<​code>​
 +listen ("What percentage change do you want to allow? {0..}[75] ",​$percentChangeImm)
 +if $percentChangeImm == ""​
 + $percentChangeImm = "​75.0"​
 + percentChangeImm[] = create (; data=75.0)
 +else
 + percentChangeImm[] = create (; data=$percentChangeImm)
 +endif
 +</​code>​
 +
 +
  
 ===== Say Command ===== ===== Say Command =====
Line 42: Line 55:
 The syntax of the menu command is: The syntax of the menu command is:
  
-menu (prompt, numItems, item1, ..., itemN, $choices[])  ​+menu (prompt, numItems, item1, ..., itemN, $choices[]; {defaultChoice={1..N},​ {oneChoice={true,​false}}})  ​
  
 where where
Line 53: Line 66:
  
 //​$choices[]//​ is an array of boolean TOOL variables. After the user has entered their menu choices, this array will contain true if the menu item has been selected and false if it has not. This array must be at least as big as the number of items in the menu. //​$choices[]//​ is an array of boolean TOOL variables. After the user has entered their menu choices, this array will contain true if the menu item has been selected and false if it has not. This array must be at least as big as the number of items in the menu.
 +
 +//​defaultChoice//​ is an integer that specifies which option is the default selection if the user does not make a selection.
 +
 +//​oneChoice//​ is an optional boolean flag that forces the user to choose only one option.
 +
 +//​**note:​**//​ If both //​defaultChoice//​ and //​oneChoice//​ are used, defaultChoice must precede oneChoice.
  
 === Example === === Example ===
howtos/toolcoding/user_interaction.1258126663.txt.gz ยท Last modified: 2009/11/13 15:37 by deryn.crockett