Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Help with buttons
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
thenest




PostPosted: Wed Nov 14, 2012 7:00 pm   Post subject: 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 :

Turing:
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:

[syntax="turing"] ... code ... [/syntax]

[code] ... code ... [/code ]
Sponsor
Sponsor
Sponsor
sponsor
Zren




PostPosted: Wed Nov 14, 2012 8:48 pm   Post subject: RE:Help with buttons

The answer can be found (probably) somewhere on this page: Gui.Quit

Also. Some food for thought. If you weren't able to use the 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




PostPosted: Thu Nov 15, 2012 10:44 am   Post subject: RE:Help with buttons

Probably would be easier just to use your own buttons, the GUI ones are more annoying to work with
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 3 Posts ]
Jump to:   


Style:  
Search: