Programming Notes For the TI-89/92(+) Calculator

Dialogs

Frank P. Westlake, September 04, 1999

Modified: December 15, 1999



After I wrote this I found T.I's information on the topic. Their's is more complete and accurate so please read it instead, I leave my version only as an alternative explanation.

Dialog

Usage:
:Dialog
: 'block'
:EndDlog

'block' is one or more of the following statements. The "Title" statement is optional but at least one of the others must be present.
 
 
INSTRUCTION MAX LINES
Text 10
DropDown 9
Request 7
Title  1
Maximum possible combinations of statements:

Read across the top for the maximum Text lines.
Read down left for the maximum DropDown lines.
Read intersection for the maximum Request lines.
 
0 1 2 3 4 5 6 7 8 9 10
0 7 6 6 5 4 3 3 2 1 1 0
1 6 6 5 4 3 3 2 1 0
2 5 5 4 3 2 2 1 0
3 5 4 3 2 2 1 0
4 4 3 2 2 1 0
5 3 2 1 1 0
6 2 1 0
7 1 1 0
8 0
9 0
A dialog can be exited by pressing either the ENTER or ESC buttons. If ENTER is pressed, the system stores the value 1 (one) into the system variable OK. If ESC is pressed, the system stores 0 (zero) into OK. The programmer can then use the value of OK to determine the users action.

Example:
:dlogtest()
:Prgm
:Local name,readbl
:Dialog
: Title "S A M P L E   D I A L O G"
: Text "Put spaces in title for readibility."
: Text "Use three spaces between words in the title."
: Text ""
: Request "Enter your name",name
: Text ""
: DropDown "Is the title readable?",{"Yes","No"},readbl
:EndDlog
:If ok=0 Then
: Text "You hit ESC"
: "not given"»name
: "Unknown readibility"»readbl
:ElseIf ok=1 Then
: Text "You hit ENTER"
: If readbl=1 then
:  "Title was readable."»readbl
: Else
:  "Title was not readable"»readbl
: EndIf
:Else
: Text "This is not possible!"
:EndIf
:Dialog
: Title "Y O U R   I N P U T"
: Text "Your name:"
: Text name
: Text ""
: Text readbl
:EndDlog
:EndPrgm

Note:
Not all strings in a Dialog may be empty (0 characters), there must be at least one character in at least one of the strings. 


Title

Usage:
Title STR

Example:
:"This is the title."»str
:Dialog
: Title str
: Text ""
:EndDlog

Max length of string STR is 50 characters. The string may be empty.
This statement may not be used alone, it must be used within a Dialog.
Title is not required in a Dialog. 


Text

Usage:
Text STR

Example:
:"This is a Text line."»str
:Dialog
: Text str
: Text "This is another line."
:EndDlog

Max length of string STR is 38 characters.
The string may be empty.
This statement may be used alone or within a Dialog.


DropDown

Usage:
DropDown STR,LIST,VAR

Example:
:2»var
:{"12345","54321"}»list
:Dialog
: DropDown "This is a 30 character string.",list,v
:EndDlog
:Disp "You selected..."
:Disp list[v]

Max length of string STR is 36, 34 minus width of widest element in LIST, or 0.
 
 
STR LIST
36 0
34 1
33 2
... ...
5 30
... ...
0 30
STR may be empty.
LIST may not have any elements wider than 30 characters.
LIST may have a single empty string.
LIST may have at most 2000 elements.
VAR is the item number selected in the dropdown list. If the integer in VAR is in range, that list item will be initially selected.
This statement may not be used alone, it must be used within a Dialog. 


Request

Usage:
Request STR,VAR

Example:
:"Another silly string"»var1
:Dialog
: Request "What is this?",var1
: Request "Enter a number",var2
:EndDlog
:expr(var2)»var2

Max length of string STR is 20 characters.
The string may be empty.
VAR will contain the entered string. If VAR already contains a string, that string will be displayed in the request box.
If VAR is expected to be a number or expression it must be converted with expr().
This statement may be used alone or within a Dialog.