PROMPT: Difference between revisions
Jump to navigation
Jump to search
m (Text replacement - "Building Blocks Categories" to "Building Blocks") |
m (1 revision imported) |
Latest revision as of 03:04, 11 October 2023
Description
- Provides a pre-made dialog window with a text-box to capture user's response. The user responds to the "string expression" message. The response is stored in "responseVar$".
Syntax
- This form allows retrieval of a string value
- prompt "string expression"; responseVar$
- This form allows retrieval of a numerical value
- prompt "string expression"; responseVar
- This form adds a Caption to the window
- prompt "Window Title" + chr$(13) + "string expression"; responseVar$
Hints
- To show a default value in the text-box, assign a string value to responseVar$ before the PROMPT statement. (The default value can be typed over by the user, if needed.)
- The response is captured and the window closed by either clicking the OK button or pressing the Enter key. Clicking Cancel returns an empty string and closes the window.
Example
' The basic PROMPT statement prompt "Please enter your name"; name$ print "Thank you, "; name$ ' The basic PROMPT statement with Caption added prompt name$ + chr$(13) + "Enter your age"; age print name$; ", you are "; age; " years old." ' With Caption and default response entered msg$ = "Yes or No" reply$ = "Yes" prompt "Continue?" + chr$(13) + msg$; reply$ print reply$ end
Useful Procedures
' Place a useful function or sub using this keyword here