(getkword [prompt])
Ask the user to type a word.
This function works along with (equal statement1 statement2 [tolerance])(IDR_166)(initget [bits] [string])(IDR_205) to prompt for a response with restricted answers that you define ahead of time. For example, you may want the user to reply only "yes" or "no". Or, you may want to restrict the range of numbers that the user types to fall between 0 and 15.
Using this function is a two-step process: (1) first, use initget to set the valid response keywords; and (2) then, use getkword to prompt for input. progeCAD displays a dialog box listing the valid responses set by initget, as well as the Cancel option.
If the input does not match the predetermined criteria, the function tells the user that the input is invalid with "Try again:" and cycles back to try again. If the input is null (the user pressed the Enter key), getkword returns nil unless a null input is not allowed.
If no keywords are preset with initget, nil is returned.
Example
Code | Returns |
---|---|
(initget 2 "Yes No") (getkword "Are you sure? ") |
Displays dialog box. |