I am trying to create a menu, just a template, that allows you to select options and view the selected option based on its color. I have not put in lines with Goto's to follow selection, right now I'm just trying to work out the menu. So far I think it should be working, but the menu just wont operate correctly. The selected option wont move past 'Option 2', except when you press up, it flickers onto option 6 and then back to 2. I have tried reviewing the code to work out kinks, But I just don't know enough basic to do this myself. Please help! Here is the code(I imported it into sourcecoder so if there are errors im sorry), and a screenshot:

Code:
DelVar ADelVar BDelVar CDelVar DDelVar EDelVar F
DelVar {Y1}DelVar {Y2}DelVar {Y3}DelVar {Y4}DelVar {Y5}DelVar {Y6}DelVar {Y7}DelVar {Y8}DelVar {Y9}DelVar {Y0}
AxesOff
BackgroundOff
ClrDraw
ZStandard
1->B:0->K
getKey->K
While K!=45
   getKey->K
If K=34 and B=6:Then:0->K:1->B:End
If K=25 and B=1:Then:0->K:6->B:End
If K=34 and B<6:Then:0->K:B+1->B:End
If K=25 and B>1:Then:0->K:B-1->B:End
If B=1:Then:1->A:2->B:2->B:2->D:2->E:2->F:End
If B=2:Then:2->A:1->B:2->C:2->D:2->E:2->F:End
If B=3:Then:2->A:2->B:1->C:2->D:2->E:2->F:End
If B=4:Then:2->A:2->B:2->C:1->D:2->E:2->F:End
If B=5:Then:2->A:2->B:2->C:2->D:1->E:2->F:End
If B=6:Then:2->A:2->B:2->C:2->D:2->E:1->F:End
   If A=1:TextColor(Red
   If A=2:TextColor(Blue
   Text(~1,10,10,"Option 1
   If B=1:TextColor(Red
   If B=2:TextColor(Blue
   Text(~1,30,10,"Option 2
   If C=1:TextColor(Red
   If C=2:TextColor(Blue
   Text(~1,50,10,"Option 3
   If D=1:TextColor(Red
   If D=2:TextColor(Blue
   Text(~1,70,10,"Option 4
   If E=1:TextColor(Red
   If E=2:TextColor(Blue
   Text(~1,90,10,"Option 5
   If F=1:TextColor(Red
   If F=2:TextColor(Blue
   Text(~1,110,10,"Option 6
End

This should work:


Code:
"OPTION 1  OPTION 2  OPTION 3  OPTION 4  OPTION 5  OPTION 6  "->Str1
1->B
Repeat Ans=45
    max(1,min(6,B+sum(DeltaList(Ans={25,34->B
    For(A,1,6
        TextColor(10+(A=B
        Text(~1,20A-10,10,sub(Str1,10A-9,10
    End
    Repeat Ans
        getKey
    End
End
Also:

Code:
DelVar {Y1}DelVar {Y2}DelVar {Y3}DelVar {Y4}DelVar {Y5}DelVar {Y6}DelVar {Y7}DelVar {Y8}DelVar {Y9}DelVar {Y0}

can be

Code:
FnOff

This just makes the graph not draw any of the functions until you turn it back on again with FnOn . It also makes it more user friendly in case the user is trying to save those functions for later.
jonbush wrote:
This should work:


Code:
"OPTION 1  OPTION 2  OPTION 3  OPTION 4  OPTION 5  OPTION 6  "->Str1
1->B
Repeat Ans=45
    max(1,min(6,S+sum(DeltaList(Ans={25,34->B
    For(A,1,6
        TextColor(10+(A=B
        Text(~1,20A-10,10,sub(Str1,10A-9,10
    End
    Repeat Ans
        getKey
    End
End

Well, I don't understand parts of your code, and when I run the program, pressing the up and down arrows don't change anything. Do I have to put that in at the

Code:
    Repeat Ans
        getKey
        -put code here-
    End

Section?
Caleb_Hill wrote:
jonbush wrote:
...
Code:
Repeat Ans
    getKey
End

Nope, this code section just waits for a keypress.
After you pressed one, it returns to the begin of the loop, where it updates the selected option.
The code seems alright, however, the S in the longest line seems out of place, it seems like it should be a 1? you might want to try that, however, I didn't test the code to see if it works as it should.
mr womp womp wrote:
The code seems alright, however, the S in the longest line seems out of place, it seems like it should be a 1? you might want to try that, however, I didn't test the code to see if it works as it should.
You're right, it should be B, not S or 1.
PT_ wrote:
mr womp womp wrote:
The code seems alright, however, the S in the longest line seems out of place, it seems like it should be a 1? you might want to try that, however, I didn't test the code to see if it works as it should.
You're right, it should be B, not S or 1.

yep. that works. I suppose that when making links for the different options, I should add a list of If / Then commands, but I don't know what variable they should be testing for (:If K=1:Goto A1 :If K=2:Goto A2, etc.), and if I need to add anything to the to to make it work.
PT_ wrote:
mr womp womp wrote:
The code seems alright, however, the S in the longest line seems out of place, it seems like it should be a 1? you might want to try that, however, I didn't test the code to see if it works as it should.
You're right, it should be B, not S or 1.

YESSSS I didn't have time to check exactly what happened to the variables, but on the bus ride back home I had a closer look and noticed that 1 was wrong and that it should be B, I was gonna edit it haha
Caleb_Hill wrote:
PT_ wrote:
mr womp womp wrote:
The code seems alright, however, the S in the longest line seems out of place, it seems like it should be a 1? you might want to try that, however, I didn't test the code to see if it works as it should.
You're right, it should be B, not S or 1.

yep. that works. I suppose that when making links for the different options, I should add a list of If / Then commands, but I don't know what variable they should be testing for (:If K=1:Goto A1 :If K=2:Goto A2, etc.), and if I need to add anything to the to to make it work.

The variable you will want to check for is B, first option B=1, second option B=2 and so on Smile
thank you guys so much
i need to learn how to BASIC like you peoples can.
'Bruh can you even BASIC' -User
PT_ wrote:
mr womp womp wrote:
The code seems alright, however, the S in the longest line seems out of place, it seems like it should be a 1? you might want to try that, however, I didn't test the code to see if it works as it should.
You're right, it should be B, not S or 1.


Sorry about that! I made it separately, and then changed it to match the variables you were using. I guess I missed one.

Caleb_Hill wrote:
yep. that works. I suppose that when making links for the different options, I should add a list of If / Then commands, but I don't know what variable they should be testing for (:If K=1:Goto A1 :If K=2:Goto A2, etc.), and if I need to add anything to the to to make it work.


You should test for the value of B; and you should only use If statements, not If/Then because of potential memory leaks.
jonbush wrote:

Caleb_Hill wrote:
yep. that works. I suppose that when making links for the different options, I should add a list of If / Then commands, but I don't know what variable they should be testing for (:If K=1:Goto A1 :If K=2:Goto A2, etc.), and if I need to add anything to the to to make it work.


You should test for the value of B; and you should only use If statements, not If/Then because of potential memory leaks.

Yeah, I only said If / Then to clarify. I will just do something like

Code:
If B=1:Goto A1
If B=2:Goto A2
etc.
  
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