
-----------------------------------
vlovich
Wed Jun 04, 2003 10:54 am

[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

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

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]

-----------------------------------
Tony
Wed Jun 04, 2003 12:01 pm


-----------------------------------
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.
