
-----------------------------------
thenest
Wed Nov 14, 2012 7:00 pm

Help with buttons
-----------------------------------
Im trying to create a program that asks if the user you would like to continue, then asks for the gender, using buttons. 

Im not to familiar with turing and have just read up a tutorial involving GUI and buttons. 

Heres my code : 

import gui 
procedure lol2
    put "Exiting...."
    quit
    %Procedure for the no button.
end lol2
procedure lol
    put "Lets continue..."
    cls
    
    GUI.Quit
    %Procedure for the yes button.
end lol 

procedure male 
put"Ok your a male." 
delay (2500) 
cls  

GUI.Quit 

end male 

procedure fe 
put "Ok your a female." 
delay (2500) 
cls 

GUI.Quit 
end fe 

loop
    
        nest
        Font.Draw ("Would you like to take a quick survey ", 140, 510, titlelol, black)
        var nest1 : int := GUI.CreateButton (140, 400, 4, "YES", lol)
        var nest2 : int := GUI.CreateButton (200, 400, 4, "NO", lol2)
        loop
            exit when GUI.ProcessEvent
        end loop 
        
        Font.Draw ("Are you a male or female?",140, 510, titlelol, red)
        var but1 : int := GUI.CreateButton (140, 400, 4, "MALE", male)
        var but2 : int := GUI.CreateButton (200, 400, 4, "FEMALE", fe)
       
        loop
            exit when GUI.ProcessEvent
        end loop  

The problem is, my second set of buttons becomes unreponsive , does anyone have a solution for this? 

Thanks in advance.

Mod Edit:

Pleas wrap you code in either of the following in order to preserve whitespace and to highlight the syntax.
 ... code ... 

[code] ... code ... [/code ]
[/code]

-----------------------------------
Zren
Wed Nov 14, 2012 8:48 pm

RE:Help with buttons
-----------------------------------
The answer can be found (probably) somewhere on this page: quit keyword (I'm talking about the one you used it the lol2 procedure), how would you change your program to cleanly exit? By cleanly exit, I mean to break out of all loops and reach the end of the code.

-----------------------------------
Raknarg
Thu Nov 15, 2012 10:44 am

RE:Help with buttons
-----------------------------------
Probably would be easier just to use your own buttons, the GUI ones are more annoying to work with
