Enter x: x
The variable name will be displayed. This can be avoided like this:
if GetType(x)="NONE":0->x
This statement is executed before the string() function. The variable is initialized if it doesn't exist,
otherwise it is unchanged.
If your program has a lot of inputs, consider saving them as a list. This creates a little more work for
you, as the programmer, but it reduces the clutter of global variables in a folder. As an example,
suppose that your program needs four inputs from the user. This example shows the basic idea.
local w,x,y,z
© Define local variables for user inputs
if gettype(defaults)="NONE"
© If the user defaults variable doesn't exist,
{1,2,3,4}
→
defaults
© ... create and initialize it
string(defaults[1])
→
w
© Initialize local copies of variables
string(defaults[2])
→
x
string(defaults[3])
→
y
string(defaults[4])
→
z
Dialog
© Prompt for new values
Request "Enter w",w
Request "Enter x",x
Request "Enter y",y
Request "Enter z",z
EndDlog
if ok=0:return
© Just quit if user presses [ESC]
expr(w)
→
w : w
→
defaults[1]
© Convert string to expression; update global copy
expr(x)
→
x : x
→
defaults[2]
expr(y)
→
y : y
→
defaults[3]
expr(z)
→
z : z
→
defaults[4]
In this example, defaults is the name of the global variable which holds the default values. If your inputs
are lists or matrices, see tip [3.24] for a method to store those data types in the default list.
[9.6] Position cursor with char(2)
Use char(2) to position the cursor in strings. This idea can be used in text displayed on the command
line, or in programs or functions. For example, if you define a custom menu item as
item "f("&char(2)&")"
then when the menu item is executed, the command line shows
f(|)
with the cursor between the parentheses, ready for you to enter your argument.
If you enclose the string with a pair of char(2) characters, then the string will be highlighted in the
command line when you select the custom menu item. This program shows the idea:
9 - 5
Содержание TI-92+
Страница 52: ...Component side of PCB GraphLink I O connector detail 1 41...
Страница 53: ...LCD connector detail PCB switch side 1 42...
Страница 54: ...Key pad sheet contact side Key pad sheet key side 1 43...
Страница 55: ...Key cap detail 1 44...
Страница 57: ...Component side of PCB with shield removed A detail view of the intergrated circuits 1 46...
Страница 59: ...Keypad rubber sheet key cap side Inside front cover showing keycaps in place Detail of a key cap 1 48...
Страница 410: ...void extensionroutine2 void Credit to Bhuvanesh Bhatt 10 4...