When I run the code below, it works fine. (TI nspire CAS II calculator) However, at the end of the program I give two options, "Enter" to repeat the program, "Esc" to quit.
"Esc" works fine. However if I pick "Enter", the RequestStr box pops up again to receive the new input as intended. When I enter the input, the program displays "You entered nothing" and goes back to the RequestStr box again. I have to press "Cancel" on the RequestStr box to get out of the loop. "You entered nothing" is part of the error code I am using to intercept the case where the user may click OK without entering anything into the box. So basically the program works fine the first time I run it, it is when I choose to rerun it again is when the issue arises.
CODE
Define LibPub funvarsolv()=
Prgm
:Local y1,res,i,ab,d,c
:
:Loop
:0→c
:1→d
:While d =1
:Try
:RequestStr "enter function",y1,0,ab
:0→d
:
:Else
:© user left input box empty
:Text "you entered nothing",0
:ClrErr
:
:EndTry
:If d=0
:Exit
:EndWhile
:© user pressed cancel
: If ab=0 Then
: Disp "Press ENTER to end"
: subrtine\delay()
: DelVar y1,i,k,ab
: Return
:
:EndIf
:
:
:
: expr("Define y1(x) ="&y1)
: res:=exp▶list(solve(y1(x)=0,x),x)
:
:Disp "Solution set: "&var&" =",res
:
:subrtine\dlay()
:If k="esc" Then
:1→c
:ElseIf k="enter" Then
:0→c
:EndIf
:If c=1
:Exit
:EndLoop
:EndPrgm