How to create TI-BASIC (TI-84+) input forms?
Asked Answered
G

2

7

In the TI-BASIC programming language (Specifically TI-84+), how do you create input forms, such as the ones included in the default apps on the TI-84+.

The image included here shows an example of what I'm trying to create: A menu that you can scroll through and input multiple variables freely before executing a function

Additionally, is it possible to make this menu dynamically-updating as variables are entered?

Georg answered 26/2, 2015 at 5:20 Comment(0)
P
6

In the TI-BASIC programming language (Specifically TI-84+), how do you create input forms, such as the ones included in the default apps on the TI-84+.

There are many ways to ask for input in your program:

  • Prompt: Asks for input and stores it in a variable. For example, Prompt A. Simplest way to ask for input, but not very visually appealing.

  • Input: Similar to the Prompt command, except that now you can include text within the input. For example, Input "What is your name?",A.

  • Menu(: Multiple choice input, and each choice is connected to a Lbl marker somewhere else in the script. Much like the error screen with the quit/goto choices that you've probably seen. For example, Menu("Are you a boy or a girl?","Boy",B,"Girl",G).

  • getKey: Checks if a certain key is pressed, and will output True (1) if that key is pressed. For example, getKey 105. See here for which numbers each key corresponds to.

The image included here shows an example of what I'm trying to create: A menu that you can scroll through and input multiple variables freely before executing a function https://i.sstatic.net/eKlpE.jpg

I'm afraid that's not possible in programs. You can either put in multiple inputs, or you might be interested in looking into making apps instead.

Additionally, is it possible to make this menu dynamically-updating as variables are entered?

If you're talking about the text on top of the screenshot, yes you can; just put a Disp command or something after each line of Input, so that it continuously overwrites the text above with new text after you input a variable.

Pikeman answered 27/2, 2015 at 4:11 Comment(6)
A little disappointing, but thank you for the help, especially with the third point.Georg
Prompt is usually used when getting multiple inputs into different variables, because it can be used as Prompt A,B,C whereas Input cannot.Carnot
@Carnot I prefer Input "A: ",A Input "B: ",B Input "C: ",C just because I like to have my displays all nice and pretty.Pikeman
That's true, but my goal is to create small programs :) you're right on that, though. I wonder if a utility could be made to do that, to shorten the code... hmm...Carnot
you might be interested in looking into making apps instead. This is wrong; in TI's world, apps and programs are two different things. The correct wording here would've been you might be interested in looking into assembly programming instead, as assembly can be used to write both programs and apps. The difference is mainly in the way they're stored and executed by the calculator.Rozellarozelle
@Pikeman by input if you want it to ask for a string (the name), you want to store it as STR1 not as a regular variable otherwise it would just be stored as the Boolean value, 1Cleome
H
7

You've set a rather tall order for TI-Basic to fill. user3932000 is correct; there is no built in function to create an input form of the type you request.

However, there is nothing stopping you from creating an interactive interface yourself. Creating it from scratch will be a time consuming and, it will consume a significant amount of memory on your calculator. There is no boilerplate code you plug your variables into to get the results you want, but you might have some luck modeling it after this quadratic solver I wrote.

ClrHome
a+bi
Output(1,1,"    QUADRATIC
Output(2,1,"    AX²+BX+C
Output(3,1,"ZEROS:
Output(6,1,"A=
Output(7,1,"B=
Output(8,1,"C=

DelVar YDelVar D
"             →Str1

While Y≠105
getKey→Y

If Ans
Then
Output(X,4,Str1
Output(3,7,Str1+Str1+Str1+"   
End

X+(Ans=34)-(Ans=25
If Ans<6:8
If Ans>8:6
Ans→X

Output(Ans,16,"◄

D(Y≠45→D

If Y=25 or Y=34
sum({A,B,C}(X={6,7,8→D

If Y=104:⁻D→D

10not(Y)+Y(102≠Y)-13int(Y/13(2>abs(5-abs(5-abs(Y-83
If Ans≤9
D10+Ans-2Ans(D<0→D

If X=6:D→A
If X=7:D→B
If X=8:D→C

If A
Then
2ˉ¹Aˉ¹(⁻B+{1,⁻1}√(B²-4AC
Else
If B
Then
⁻C/B
Else
If C
Then
"No Zeros
Else
"All Numbers
End
End
End

Output(3,7,Ans
Output(6,3,A
Output(7,3,B
Output(8,3,C
End
ClrHome
Ans

Here's a GIF of what it does for you.

With a little more work. This code could be used on the Graph screen instead of the home screen, giving more option in terms of layout and design.

Hudgens answered 27/2, 2015 at 11:59 Comment(8)
Excellent! +10 by the way, you seem to be good at optimizing, but you can save a byte 16→X:0→D can be Delvar D6→X also the long spaces, you can have at the beginning " →Str1 and then Output(X,4,Str1:Output(3,7,Str1+Str1+Str1+" "Carnot
@Carnot Nice catch with the Delvar improvement. As for the Str1 improvement, It got me wondering about the cost of concatenation in TI-basic. If it's constant there wouldn't be an issue, but if it works in linear time, that might affect the speed.Hudgens
You're right, I was thinking the same thing. You don't seem to run that code unless Enter is pressed, though, so it shouldn't affect the speed.Carnot
P.S. D*10+Ans→D can be shortened to D10+Ans→DCarnot
@Carnot I'm not sure why I didn't initialy use implicit multiplicationHudgens
Also the While Y!=105 can be Repeat Y=105; then, you can remove the first getKey->YCarnot
@Carnot I made some additional changes to the code and have updated my answer. Additional suggestion are always appreciated.Hudgens
Wow, this is really good. I think I'll use it for a dynamic pythagorean theorem solver that can solve for two sides :)Carnot
P
6

In the TI-BASIC programming language (Specifically TI-84+), how do you create input forms, such as the ones included in the default apps on the TI-84+.

There are many ways to ask for input in your program:

  • Prompt: Asks for input and stores it in a variable. For example, Prompt A. Simplest way to ask for input, but not very visually appealing.

  • Input: Similar to the Prompt command, except that now you can include text within the input. For example, Input "What is your name?",A.

  • Menu(: Multiple choice input, and each choice is connected to a Lbl marker somewhere else in the script. Much like the error screen with the quit/goto choices that you've probably seen. For example, Menu("Are you a boy or a girl?","Boy",B,"Girl",G).

  • getKey: Checks if a certain key is pressed, and will output True (1) if that key is pressed. For example, getKey 105. See here for which numbers each key corresponds to.

The image included here shows an example of what I'm trying to create: A menu that you can scroll through and input multiple variables freely before executing a function https://i.sstatic.net/eKlpE.jpg

I'm afraid that's not possible in programs. You can either put in multiple inputs, or you might be interested in looking into making apps instead.

Additionally, is it possible to make this menu dynamically-updating as variables are entered?

If you're talking about the text on top of the screenshot, yes you can; just put a Disp command or something after each line of Input, so that it continuously overwrites the text above with new text after you input a variable.

Pikeman answered 27/2, 2015 at 4:11 Comment(6)
A little disappointing, but thank you for the help, especially with the third point.Georg
Prompt is usually used when getting multiple inputs into different variables, because it can be used as Prompt A,B,C whereas Input cannot.Carnot
@Carnot I prefer Input "A: ",A Input "B: ",B Input "C: ",C just because I like to have my displays all nice and pretty.Pikeman
That's true, but my goal is to create small programs :) you're right on that, though. I wonder if a utility could be made to do that, to shorten the code... hmm...Carnot
you might be interested in looking into making apps instead. This is wrong; in TI's world, apps and programs are two different things. The correct wording here would've been you might be interested in looking into assembly programming instead, as assembly can be used to write both programs and apps. The difference is mainly in the way they're stored and executed by the calculator.Rozellarozelle
@Pikeman by input if you want it to ask for a string (the name), you want to store it as STR1 not as a regular variable otherwise it would just be stored as the Boolean value, 1Cleome

© 2022 - 2024 — McMap. All rights reserved.