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

Username:   Password: 
 RegisterRegister   
 [tutorial] GUI buttons not depressing
Index -> Programming, Turing -> Turing Tutorials
View previous topic Printable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
vlovich




PostPosted: Wed Jun 04, 2003 10:54 am   Post subject: [tutorial] GUI buttons not depressing

I recently came across this in my program where despite the fact that I was doing exit when GUI.ProcessEvent, my buttons did not depress.

here is an example

code:
setscreen ("offscreenonly")

var but1 := GUI.CreateButton (0,0,0, "Button 1", [i]buttonProc1[/i])
var but2 := GUI.CreateButton (10,10, 0, "Quit", GUI.Quit)

loop
    exit when GUI.ProcessEvent
end loop


the solution turns out to be

code:
setscreen ("offscreenonly")

var but1 := GUI.CreateButton (0,0,0, "Button 1", [i]buttonProc1[/i])
var but2 := GUI.CreateButton (10,10, 0, "Quit", GUI.Quit)

loop
    setscreen ("nooffscreenonly")
    exit when GUI.ProcessEvent
    setscreen ("offscreenonly")
end loop


the obvious advantage of switching between the two in the second example is that you want the button to look nice but don't want ugly flickering if your doing animation with View.Update (for turing 4)[/i]
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Wed Jun 04, 2003 12:01 pm   Post subject: (No subject)

thats because of how GUI is structured. Another way of solving it would be to ether place View.Update inside the loop or throughout the GUI module.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
Display posts from previous:   
   Index -> Programming, Turing -> Turing Tutorials
View previous topic Tell A FriendPrintable versionDownload TopicRate TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: