
-----------------------------------
MikeAlexnder
Tue Dec 23, 2008 1:18 pm

Turing Help (urgent)
-----------------------------------
How do I create menus and submenus so when the user is in a submenu they can go back to the main menu if they want?

-----------------------------------
MikeAlexnder
Tue Dec 23, 2008 1:19 pm

RE:Turing Help (urgent)
-----------------------------------
PLEASE HELP ME!

-----------------------------------
MikeAlexnder
Tue Dec 23, 2008 1:22 pm

RE:Turing Help (urgent)
-----------------------------------
My code is like this right now:
put "dssdsdsds"
put "1=3443434"
put "2=dsadasdas"
var option: int
get option 
case option of
label 1 : put "dsadasdas"
            var option2:int
             get option2
             case option2 of
          label 1:32323232
          label 2: 4343434343
label 2: put fdsfsfsdfsd

Mod Edit: Remember to use syntax tags! Thanks :) [syntax="turing"]Code Here[/syntax]

-----------------------------------
OneOffDriveByPoster
Tue Dec 23, 2008 1:42 pm

Re: Turing Help (urgent)
-----------------------------------
How do I create menus and submenus so when the user is in a submenu they can go back to the main menu if they want?You can use a loop.  Have an option on each submenu for going back to the main menu.  If the user chooses that option, make the code go back to the top of the loop where the main menu is.

-----------------------------------
DanielG
Tue Dec 23, 2008 6:18 pm

RE:Turing Help (urgent)
-----------------------------------
easiest way is to use procedures, make each menu a procedure and when you choose something in a menu, it can just call any of the other menus (or if going back to a previous one, just use return)

-----------------------------------
Insectoid
Tue Dec 23, 2008 6:58 pm

RE:Turing Help (urgent)
-----------------------------------
you made 3 posts in the same thread in under 4 minutes. 'bumping' is not allowed on compsci, especially 1 minute from the original post.

-----------------------------------
MikeAlexnder
Tue Dec 23, 2008 7:05 pm

RE:Turing Help (urgent)
-----------------------------------
Can you shoew me how?

-----------------------------------
syntax_error
Tue Dec 23, 2008 10:21 pm

Re: Turing Help (urgent)
-----------------------------------

proc foo
/* magic code here */
end foo

proc bar
/* magical-er code here */
end bar

proc blag
/* magical-er-er code here */
end blag

loop
 put "foo"
 put "bar"
 put "blag"
 get choice
  if choice ==1
   cls
   loop
   bar
     exitcommand == true then exit
   end loop   
  
  else if choice == 2

   cls
   loop
   blag
     exitcommand == true then exit
   end loop 

  else if choice == 3

   cls
   loop
   foo
     exitcommand == true then exit
   end loop 

  end if

  end loop
 
end loop






Just a outline. 

Note: not to scale.

-----------------------------------
Insectoid
Wed Dec 24, 2008 10:55 am

RE:Turing Help (urgent)
-----------------------------------
Okay, so the main menu is in a loop. When you click a button, it goes to that menu's procedure, which contains a loop. When you click 'back', it exits that loop, which will then return to the main menu. 

syntax_error, in Turing comparisons are done with a single = rather than ==. Just pointing it out :P.


proc menu1
    loop
        %mouse stuff
        exit when exitButton clicked
    end loop
end menu1

proc menu2
    %same as menu1, but with different options
end menu2

%main menu
loop
    if menu1 button clicked then
        menu1
    elsif menu2 button clicked then
        menu2
    end if
end loop


-----------------------------------
MikeAlexnder
Wed Dec 24, 2008 1:02 pm

RE:Turing Help (urgent)
-----------------------------------
Can you help me edit my program so it will be in this form? If anyone can than I will send you my program or post it. My program is done and fuctional I just need to put in in the form above. I tried but I failed :cry:

-----------------------------------
Insectoid
Wed Dec 24, 2008 1:05 pm

RE:Turing Help (urgent)
-----------------------------------
Nope. That's called 'thinking'. It's a huge part of programming.

-----------------------------------
MikeAlexnder
Wed Dec 24, 2008 1:06 pm

RE:Turing Help (urgent)
-----------------------------------
PLEASE!!!I BEG YOU!!!!

-----------------------------------
S_Grimm
Wed Dec 24, 2008 1:18 pm

RE:Turing Help (urgent)
-----------------------------------
1) Caps Lock should be off when typing
2) We don't do work for you. We will point you in the right direction and give you samples, but never will we write the code for you. EVER.

3) The Code is in this thread. Just take a look. Think about how to do it, then implement it. Don't worry if it doesn't work at first, just trouble shoot it untill you get it to work.

4) If / Else constructs

-----------------------------------
MikeAlexnder
Wed Dec 24, 2008 8:07 pm

RE:Turing Help (urgent)
-----------------------------------
It doesn't work!!!!

-----------------------------------
Insectoid
Wed Dec 24, 2008 8:35 pm

Re: RE:Turing Help (urgent)
-----------------------------------
The Code is in this thread. Just take a look. Think about how to do it, then implement it. Don't worry if it doesn't work at first, just trouble shoot it untill you get it to work.

If it doesn't work, you haven't done this.

-----------------------------------
DanielG
Wed Dec 24, 2008 10:23 pm

RE:Turing Help (urgent)
-----------------------------------
Also, if you get some sort of error you don't understand, or you don't understand why a specific thing you wrote isn't working, you can repost your code and someone could help you

-----------------------------------
TheGuardian001
Wed Dec 24, 2008 11:27 pm

Re: Turing Help (urgent)
-----------------------------------
Abbreviating swearwords is more likely to get people to ignore you than help you. There have been multiple ideas posted that will work in this situation. if you just use their suggestions you should be able to figure this out.

Personally, I would go with the procedures.


proc menu1()
    %contents
    loop
        exit when whatever
    end loop
end menu1
proc menu2()
%more contents!
    loop
        exit when whatever
    end loop
end menu2
proc menu3()
%EVEN MORE CONTENTS!
    loop
        exit when whatever
    end loop
end menu3

proc mainMenu()
    put "option1"
    put "option2"
    put "option3
    get choice
    if choice was 1
        menu1
    elsif choice was 2
        menu2
    elsif choice was 3
        menu3
    end if
end mainMenu

loop
mainMenu
end loop


This is essentially a working solution! you just need to put it into Turing and put in menu contents! not only is this a working solution, but TWO other people have already posted almost the exact same thing. when you ask for help, actually read the advice people give you! then you can solve the problem on your own!
