? DIALOG guide ● SmileBASIC Source

Sign In

*Usernames are case-sensitive
Forgot my password
Creep into the Halloween / Horror Programming Contest (Deadline Extended)

DIALOG guide

DIALOG is used to display a textbox on the bottom screen. It's useful for debugging and simple menus. There are 3 forms of the DIALOG command: DIALOG( text$ [ , [ buttonType% ] [ , title$ [ , [ timeout% ] ] ] ] ) DIALOG(text$) DIALOG(text$,buttonType%) DIALOG(text$,,title$) DIALOG(text$,buttonType%,title$) DIALOG(text$,,title$,) DIALOG(text$,buttonType%,title$,) DIALOG(text$,,title$,timeout%) DIALOG(text$,buttonType%,title$,timeout%)

Return value

1 - User selected OK/Yes/Next/Run (or pressed A), or pressed one of the buttons specified by buttonType% 0 - Dialog disappeared because the timeout period ended. -1 - User selected No/Back/Cancel (or pressed B) The system variable RESULT is set to the same value.


The message to display in the dialog box. This will be displayed in a variable width font. CHR$(10) and 13 can be used to add line breaks. If the text is too long to fit, it will be cut off at the bottom.


Optional. Controls the on-screen buttons that appear at the bottom of the textbox 0 - / OK 1 - No / Yes 2 - Back / Next 3 - Cancel / OK 4 - Cancel / Run 5 - / Next Values between -1 and -15 can be used to control which buttons will end the textbox. (no buttons will display on the screen) -1 - A, B, X, or Y -2 - d-pad -4 - L or R -8 - touch screen You can choose multiple options by adding the values. For example, -5 will allow A, B, X, Y, L, or R.


Optional. Defaults to "DIALOG" Text to display at the top of the dialog box. Text that is too long will be cut off with ... at the end. If you use CHR$(10) or 13, it will not display any characters after that.


Optional. Defaults to 0 If this value is positive, the textbox will disappear automatically after that many seconds. Negative values will count in frames (1/60 of a second) instead. (This is undocumented.) 0 will cause the dialog box to stay forever (until a button is pressed) DIALOG text$ [ , [ buttonType% ] [ , title$ [ , [ timeout% ] ] ] ] You can also call DIALOG without a return value (RESULT will still be set) This works the same as the previous form. DIALOG( initial$, title$ [, maxLength% ] ) DIALOG(initial$,title$) DIALOG(initial$,title$,maxLength%) This form of DIALOG allows the user to input text. Allowed symbols are: 0-9, A-Z, -, _, and .

Return value

The return value will be a string containing at least 1 of the previously mentioned characters, with a maximum length set by maxLength%. If the user presses B or [Back], it will return an empty string, and RESULT will be set to -1, otherwise RESULT is set to 1.


The initial value of the input box. If it is longer than maxLength%, it will be cut off. It is converted to uppercase, and an error will occur if it has any characters that are not allowed.


The title of the textbox. The same as in the other forms of DIALOG.


Optional. Defaults to 14. The maximum length of the input string. Can be between 1 and 14.
1 vote
  • textbox
  • input
  • text
0 Comment(s)