The Dialog Command

dialog.png

Command Summary

Displays a dialog box for input or output.

Command Syntax

:Dialog
(dialog elements)
:EndDlog

Menu Location

Starting in the program editor:

  • Press F3 to enter the I/O menu.
  • Press 1 to enter the Dialog submenu.
  • Press 5 to paste Dialog..EndDlog.

Calculator Compatibility

This command works on all calculators.

Token Size

2 bytes for Dialog;
2 bytes for EndDlog.

A Dialog..EndDlog block is used to display a dialog box that can be used for input, output, or both. There are several commands that can be used inside Dialog..EndDlog to determine its content:

  • At most one Title instruction (to add a title).
  • Text (to add a line of text).
  • Request (to add a text entry box).
  • DropDown (to add a drop-down menu).

Except for the Title instruction, you can mix and match any number of these (as many as will fit on the screen), and their order will determine the order they are displayed. Finally, two "buttons" labeled Enter=OK and ESC=CANCEL will be displayed at the bottom of the dialog box.

Here is a typical dialog box to input a variable name:

:Dialog
: Title "Load file"
: Request "File name", name
: Text "(include folder name if not ""main"")"
:EndDlog

Advanced Uses

The system variable "ok" will detect if Enter or ESC was used to exit the dialog: it will have a value of 1 if Enter was used, and 0 for ESC.

This is particularly important when you're looking for input. If ESC is used, then the variables used in Request or DropDown will not be changed from what they were before (if they were undefined, they will remain undefined). It's probably a good idea to detect that sort of thing.

Error Conditions

230 - Dimension happens when the dialog would be too wide or too tall to fit on the screen.

470 - Invalid in Dialog..EndDlog block happens when instructions other than Title, Text, Request, DropDown are used.

590 - Invalid syntax block happens when something miscellaneous goes wrong, e.g. there is more than one Title.

730 - Missing start or end of block syntax happens when the Dialog is missing its EndDlog, or vice versa.

Related Commands

See Also

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License