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

Username:   Password: 
 RegisterRegister   
 Picture Button Help! Please Help!
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
LadyFlamestress




PostPosted: Mon Dec 28, 2009 1:52 am   Post subject: Picture Button Help! Please Help!

What is it you are trying to achieve?
To use picture buttons more then once.


What is the problem you are having?
It will go through one set of the buttons, but then it won`t let the other set be clickable.


Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
This is the more important section.

Turing:


delay (2000)
Pic.DrawSpecial (story1, 1, 1, picCopy, picFadeIn, 2500)
delay (200)

story1yesbutton := GUI.CreatePictureButton (610, 1, story1yes, Story1Good)
story1nobutton := GUI.CreatePictureButton (95, 1, story1no, Story1Bad)


loop
    exit when GUI.ProcessEvent
end loop

cls


procedure Story2Good
    colorback (white)
    cls

    GUI.Hide (story2yesbutton)
    GUI.Hide (story2nobutton)

    GUI.Disable (story2yesbutton)
    GUI.Disable (story2nobutton)


end Story2Good

procedure Story2Bad
    colorback (white)
    cls

    GUI.Hide (story2yesbutton)
    GUI.Hide (story2nobutton)
    GUI.Hide (story2waitbutton)

    GUI.Disable (story2yesbutton)
    GUI.Disable (story2nobutton)
    GUI.Disable (story2waitbutton)

    Pic.DrawSpecial (lake1, 1, 1, picCopy, picFadeIn, 2500)

end Story2Bad

procedure Story2Wait
    colorback (white)
    cls

    GUI.Hide (story2yesbutton)
    GUI.Hide (story2nobutton)
    GUI.Hide (story2waitbutton)

    GUI.Disable (story2yesbutton)
    GUI.Disable (story2nobutton)
    GUI.Disable (story2waitbutton)


end Story2Wait



Pic.DrawSpecial (lake1, 1, 1, picCopy, picFadeIn, 2500)

delay (100)
Pic.DrawSpecial (story2, 1, 1, picCopy, picFadeIn, 2500)
delay (200)

story2yesbutton := GUI.CreatePictureButton (670, 1, story2yes, Story2Good)
story2nobutton := GUI.CreatePictureButton (20, 1, story2no, Story2Bad)
story2waitbutton := GUI.CreatePictureButton (350, 1, story2wait, Story2Wait)


loop
    exit when GUI.ProcessEvent
end loop



Please specify what version of Turing you are using
Turing 4.1
Sponsor
Sponsor
Sponsor
sponsor
TheGuardian001




PostPosted: Mon Dec 28, 2009 2:25 am   Post subject: Re: Picture Button Help! Please Help!

Your important section is missing some important sections. Specifically the procedures Story1Good and Story1Bad (need to see the program flow from when you press the first button, not just afterward). Although it might be easier to just post the entire thing, as it's often easier to find problems in a program if we can run it ourselves.

Based on what you have here though, I'd assume the problem is in a misunderstanding of how GUI.ProcessEvent works (which is not really your fault, the way you're told to use it is confusing.)

basically, exit when GUI.ProcessEvent never returns true, until GUI.Quit is called (which kills the GUI entirely, don't call it unless you're done with GUI.) This means that when you put something like this:
code:

loop
    exit when GUI.ProcessEvent
end loop
put "hello!"

your program will never output hello. This means that if you are going to have GUI.ProcessEvent in its own loop, only one of these loops should be in your program, and it should be at the very end of your program.

In addition, absolutely everything else in your program must be called from a procedure if you want your program to run in the correct order. Anything not in a procedure will happen before the user is able to click the buttons properly.
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  [ 2 Posts ]
Jump to:   


Style:  
Search: