Hi all,

I would like to inquire about how to make a program on my ti 89 titantium so that I can choose which option I want from the menu.

For example:

option 1
option 2

is displayed and i choose which one I want to excute and it then prompts me what values to enter

I can't seem to find a Lbl / menu i/o for this.

Thank you so much in advance,

L
anyone anyone?
Sorry, I don't have a 89 ti so I can't really help. Have you tried looking at http://tibasicdev.wikidot.com/68k:home ?
I guess I now have to do ti-89s as well Razz
The syntax for a menu on the ti-89 is quite different from the ti-84's Menu(). Here is how it goes:

Code:
menu()
Prgm
ToolBar
Title "Menu Title"
Item "opt1",lbl1
Item "opt2",lbl2
Item "opt3",lbl3
EndTBar
Lbl lbl1
[code for label 1]
Lbl lbl2
[code for label 2]
Lbl lbl2
[code for label 2]
EndPrgm

Obviously, the ti-89's menu system works with the F1-F8 keys, and by extension, so do the menus that basic programs create (the screen will clear and only the menus defined in your program should be visible in the toolbar). This system actually allows you to have up to 8 menus available at once.
It is also possible to create a Dialog with a dropdown which will have a similar effect, but will store the user's input to a variable instead of jumping to a label. Here's the syntax for a dropdown:

Code:
dlog()
Prgm
Dialog
DropDown "Title", {"opt1", "opt2", "opt3"}, a
EndDlog
[morecode]
EndPrgm

once the code block is reached, 'a' will hold a value between 1 and 3 depending on the user's input.
mr womp womp wrote:
I guess I now have to do ti-89s as well Razz
The syntax for a menu on the ti-89 is quite different from the ti-84's Menu(). Here is how it goes:

Code:
menu()
Prgm
ToolBar
Title "Menu Title"
Item "opt1",lbl1
Item "opt2",lbl2
Item "opt3",lbl3
EndTBar
Lbl lbl1
[code for label 1]
Lbl lbl2
[code for label 2]
Lbl lbl2
[code for label 2]
EndPrgm

Obviously, the ti-89's menu system works with the F1-F8 keys, and by extension, so do the menus that basic programs create (the screen will clear and only the menus defined in your program should be visible in the toolbar). This system actually allows you to have up to 8 menus available at once.
It is also possible to create a Dialog with a dropdown which will have a similar effect, but will store the user's input to a variable instead of jumping to a label. Here's the syntax for a dropdown:

Code:
dlog()
Prgm
Dialog
DropDown "Title", {"opt1", "opt2", "opt3"}, a
EndDlog
[morecode]
EndPrgm

once the code block is reached, 'a' will hold a value between 1 and 3 depending on the user's input.


Thank you so much !!!!

I have determined that the F1 menu setting would be most optimal for me to set up my program.

But I've ran into an issue where Once I execute lbl1, it will continue to prompt me questions for lb2, how do i make it so its separate and I can return to the home screen after just lbl1 or lbl2?

this is what my code looks like for my program:

Code:

p()
Prgm
Toolbar
Title "Menu"
Item "Solve for Keq", l1
Item "Solve for H", l2
EndTBar
Lbl1 l1
298*8.3145->q
96500->f
Input "#e-", a
Input "ε std state", b
q/(a*f)->c
b/c->d
2.718^d->e
Disp "ε▫ Keq = ", e
lbl l2
Input "T1", a
Input "T2", b
b-a->c
Disp "T= ", c

EndPrgm
Yep, that's how labels work. If you want to jump out, you should create a label after all your options, and add a Goto to jump to that label after each option, which should have an effect similar to a 'break' in Java.
mr womp womp wrote:
Yep, that's how labels work. If you want to jump out, you should create a label after all your options, and add a Goto to jump to that label after each option, which should have an effect similar to a 'break' in Java.


Could you please provide a brief example ? I'm not a cs programmer and would greatly appreciate a demonstration of short code illustrating this jump out / break out of each lbl I have.

Thanks again!

L
Basically you want to jump out of the whole menu area before starting the next menu option.


Code:
p()
Prgm
Toolbar
Title "Menu"
Item "Solve for Keq", l1
Item "Solve for H", l2
EndTBar
Lbl l1
298*8.3145->q
96500->f
Input "#e-", a
Input "ε std state", b
q/(a*f)->c
b/c->d
2.718^d->e
Disp "ε▫ Keq = ", e
Goto JMP
Lbl l2
Input "T1", a
Input "T2", b
b-a->c
Disp "T= ", c
Lbl JMP
EndPrgm

Since you only have 2 options, you only need 1 Goto. The 2nd options will naturally continue to JMP.
mr womp womp wrote:
It is also possible to create a Dialog with a dropdown which will have a similar effect, but will store the user's input to a variable instead of jumping to a label. Here's the syntax for a dropdown:

Code:
dlog()
Prgm
Dialog
DropDown "Title", {"opt1", "opt2", "opt3"}, a
EndDlog
[morecode]
EndPrgm

once the code block is reached, 'a' will hold a value between 1 and 3 depending on the user's input.


Be sure to check the “ok” variable after using a Dialog block. If the user cancels the dialog with ESC, the dialog results will not be stored to the variables, and your program will encounter an error or otherwise behave inappropriately if it tries to access them. ok will be 1 if the dialog was accepted, meaning you can safely check the menu option (or other dialog variables) and proceed. If ok is 0, the user elected to cancel, and your program should instead do something else (such as quit or return to a previous menu/prompt).

There's one more way to create a menu: If you just want a simple one-level menu that pops up in the middle of the screen and waits for a choice, this is the simplest method. I'd say this is the closest analogue to the TI-83/84+ style menus:

Code:
Prgm
0→c
PopUp {"Option 1", "Option 2"}, c
If c=0 Then
[user canceled the menu without selecting something, so respond accordingly, such as quitting or going back to previous screen]
ElseIf c=1 Then
[first option chosen]
ElseIf c=2 Then
[second option chosen]
EndIf
EndPrgm


The variable for the menu choice (“c” in this example) should be initialized before using PopUp. I recommend setting it to 0. If the user cancels the menu, the variable will stay at its previous value. This way you can tell whether the menu was canceled without a selection and again respond appropriately.
If I have more than 2 options what should the skeleton code look like?


Code:

p()
Prgm
Title "Menu"
Item "1", l1
Item "2", l2
Item "3", l3
Item "4", l4
EndTbar
Lbl l1
{code for Lbl l1}
Goto Exit
Lbl l2
{code for Lbl l2}
Lbl l3
{code for Lbl l3}
Lbl l4
{code for Lbl l3}
Lbl Exit
End Prgm


or do I need a goto Exit after Lbl 2, 3 but not 4?
mr womp womp wrote:
Basically you want to jump out of the whole menu area before starting the next menu option.


Code:
p()
Prgm
Toolbar
Title "Menu"
Item "Solve for Keq", l1
Item "Solve for H", l2
EndTBar
Lbl l1
298*8.3145->q
96500->f
Input "#e-", a
Input "ε std state", b
q/(a*f)->c
b/c->d
2.718^d->e
Disp "ε▫ Keq = ", e
Goto JMP
Lbl l2
Input "T1", a
Input "T2", b
b-a->c
Disp "T= ", c
Lbl JMP
EndPrgm

Since you only have 2 options, you only need 1 Goto. The 2nd options will naturally continue to JMP.
Yes, you would need a Goto after 2 and 3 since you don't want the program to keep going at those points.
Don't forget the “Toolbar” instruction before the “Title” line, too.

You'll also need to use a different name besides “Exit” for you Lbl because Exit is the name of a built-in command. This will give you a syntax error.

Lbl commands don't change the flow of execution, only Goto and looping structures. Thus, when the program hits a Lbl line, it will just disregard it and continue with the next line of code. So, as mr womp womp said, you'll want a Goto to the end of the program (or wherever you want) before each Lbl that precedes the code for the next option. You don't need one at the end of the last option, before the label at the end of the program, though, because the code will just continue through the Lbl and to the end of the program. You only need a Goto there if want the program to go somewhere else instead.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement