Login [Register]
Don't have an account? Register now to chat, post, use our tools, and much more.
This is an archived, read-only copy of the United-TI subforum , including posts and topic from May 2003 to April 2012. If you would like to discuss any of the topics in this forum, you can visit Cemetech's TI-BASIC subforum. Some of these topics may also be directly-linked to active Cemetech topics. If you are a Cemetech member with a linked United-TI account, you can link United-TI topics here with your current Cemetech topics.

This forum is locked: you cannot post, reply to, or edit topics. 68k Calculator Basic => TI-BASIC
Author Message
IAmSalvation


Newbie


Joined: 12 May 2006
Posts: 5

Posted: 16 May 2006 09:36:55 am    Post subject:

I am programing a large calculus thing for my AP Calc teacher, and it's all going well, but it's quite big. Also, I've found that some people simply don't know wtf they are doing even though it's fairly self-explanitory. Anyway, I'm using PopUp and Dialog menus, and it's all working well, but to decide which program you use I'm using IF statements, and the problem is if I press ESC, it says undifined variable and it dies. How do I get the ESC key to be used as input? What do I put? My VOL program is below.

I realize that it's a huge frickin program and that I can optimize it a lot, but just haven't gotten around to that yet.


I am using a TI-89 Titanium



Code:
()
Prgm
Local  v,e,a,b,r,dw,e1,e2,l,ss
PopUp  {"Section","Shell"},ss

If ss=1 Then
PopUp  {"Disk","Washer"},dw

If dw=1 Then

Dialog
Title  "Parameters"
Request  "Equation",e
Request  "Left Limit",a
Request  "Right Limit",b
DropDown  "Rotation about",{"x","y","H line","V line"},r
EndDlog

expr(e)e
expr(a)a
expr(b)b

If r=1 Then
(*e^2,x,a,b)v

ElseIf r=2 Then
(*e^2,y,a,b)v

ElseIf r=3 Then
Dialog
Title  "Parameters"
Request  "H. Line: y=",l
EndDlog
expr(l)l
(*(l-e)^2,x,a,b)v

ElseIf r=4 Then
Dialog
Title  "Parameters"
Request  "V. Line: x=",l
EndDlog
expr(l)l
(*(l-e)^2,y,a,b)v

EndIf

Disp  [[v,approx(v)]]

ElseIf dw=2 Then

Dialog
Title  "Parameters"
Request  "Top Equation",e1
Request  "Bottom Equation",e2
Request  "Left Limit",a
Request  "Right Limit",b
DropDown  "Rotation about",{"x","y","H line","V line"},r
EndDlog

expr(e1)e1
expr(e2)e2
expr(a)a
expr(b)b

If r=1 Then
(*(e1^2-e2^2),x,a,b)v

ElseIf r=2 Then
(*(e1^2-e2^2),y,a,b)v

ElseIf r=3 Then
Dialog
Title  "Parameters"
Request  "H. Line: y=",l
EndDlog
expr(l)l
(*((l-e1)^2-(l-e2)^2),x,a,b)v

ElseIf r=4 Then
Dialog
Title  "Parameters"
Request  "V. Line: x=",l
EndDlog
expr(l)l
(*((l-e1)^2-(l-e2)^2),y,a,b)v

EndIf

Disp  [[v,approx(v)]]
EndIf

ElseIf ss=2 Then

PopUp  {"Disk","Washer"},dw

If dw=1 Then

Dialog
Title  "Parameters"
Request  "Equation",e
Request  "Left Limit",a
Request  "Right Limit",b
DropDown  "Rotation about",{"y","x","V line","H line"},r
EndDlog

expr(e)e
expr(a)a
expr(b)b

If r=1 Then
(2**x*e,x,a,b)v

ElseIf r=2 Then
(2*y**e,y,a,b)v

ElseIf r=3 Then
Dialog
Title  "Parameters"
Request  "H. Line: y=",l
EndDlog
expr(l)l
(2**(1-x)*e,x,a,b)v

ElseIf r=4 Then
Dialog
Title  "Parameters"
Request  "V. Line: x=",l
EndDlog
expr(l)l
(2**(1-y)*e,y,a,b)v

EndIf

Disp  [[v,approx(v)]]

ElseIf dw=2 Then

Dialog
Title  "Parameters"
Request  "Top Equation",e1
Request  "Bottom Equation",e2
Request  "Left Limit",a
Request  "Right Limit",b
DropDown  "Rotation about",{"x","y","V line","H line"},r
EndDlog

expr(e1)e1
expr(e2)e2
expr(a)a
expr(b)b

If r=1 Then
(2**x*(e1-e2),x,a,b)v

ElseIf r=2 Then
(2**y*(e1-e2),y,a,b)v

ElseIf r=3 Then
Dialog
Title  "Parameters"
Request  "V. Line: x=",l
EndDlog
expr(l)l
(2**(l-x)*(e1-e2),x,a,b)v

ElseIf r=4 Then
Dialog
Title  "Parameters"
Request  "H. Line: y=",l
EndDlog
expr(l)l
(2**(l-y)*(e1-e2),y,a,b)v

EndIf

Disp  [[v,approx(v)]]

EndIf
EndIf

EndPrgm


Last edited by Guest on 16 May 2006 09:38:21 am; edited 1 time in total
Back to top
todlangweilig


Advanced Member


Joined: 14 Feb 2006
Posts: 470

Posted: 16 May 2006 04:14:03 pm    Post subject:

Are you pressing ESC inside of a window? I think that would cause the variable that should be inputted to be undefined. Then obviously your program will crash.

What are you trying to make ESC do?
Back to top
IAmSalvation


Newbie


Joined: 12 May 2006
Posts: 5

Posted: 16 May 2006 04:41:28 pm    Post subject:

For all instances (popup and dialoge) to go back to the previous window, which I can do with a goto command, but i don't know how to do it if they press the ESC key.
Back to top
DarkerLine
ceci n'est pas une |


Super Elite (Last Title)


Joined: 04 Nov 2003
Posts: 8328

Posted: 16 May 2006 06:11:12 pm    Post subject:

The system variable ok is equal to 0 when the user used [esc] to quit out of the last menu.
Back to top
IAmACalculator
In a state of quasi-hiatus


Know-It-All


Joined: 21 Oct 2005
Posts: 1571

Posted: 16 May 2006 06:39:58 pm    Post subject:


Code:
Try
PopUp  {"Section","Shell"},ss
Else
<stuff to do if they push [ESC]>
EndTry
This executes the code after the [font="courier new"]Else if there is any kind of error. Use the [font="courier new"]Try...EndTry code around those pesky dialog/popup boxes.

For more info, see the TI-Freakware tutorial.

Last edited by Guest on 16 May 2006 07:20:44 pm; edited 1 time in total
Back to top
IAmSalvation


Newbie


Joined: 12 May 2006
Posts: 5

Posted: 18 May 2006 10:50:22 am    Post subject:

So I tried the TRY dialogue on the first popup and pressed ESC, and it didn't work. This is my code

Code:
()
Prgm
Local v,e,a,b,r,dw,e1,e2,l,ss
Lbl q
Try
PopUp {"Section","Shell"},ss
Else
Goto m
EndTry

...

Code:
ClrIO
Disp [[v,approx(v)]]
Lbl m
EndPrgm


Any thoughts?
Also, any thoughts on optimizing this?


EDIT: It doesn't work for the dialog boxes either. Is there an easier way to write this program? One that would make going backward feasiable?


Last edited by Guest on 18 May 2006 10:58:38 am; edited 1 time in total
Back to top
Display posts from previous:   
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
    »
» View previous topic :: View next topic  
Page 1 of 1 » All times are GMT - 5 Hours

 

Advertisement