
-----------------------------------
RowanV
Sat May 03, 2014 12:49 pm

Turing GUI Buttons Won't Clear
-----------------------------------
Hey everyone, I am still somewhat new to Turing, and I've been having trouble with my game. I made a series of buttons (a main menu) and one of the buttons on the main menu goes to another set of buttons (a level selector). My problem is that the buttons from the original menu don't go away, they are registered when clicked as opposed to the new buttons, no matter how much I try to get rid of them using commands like dispose, disable, hide, and cls. I made this sample to show you the most basic form of my problem. Help please!

import GUI
forward proc Button1
forward proc Button2
forward proc End
body proc End
    put "Done"
end End
body proc Button1
    cls
    var Buttonx : int := GUI.CreateButtonFull (maxx div 2 - 250, maxy div 2 - 50, 500, "Button1", Button2, 100, 's', true)
    loop
        exit when GUI.ProcessEvent
    end loop
    GUI.Dispose (Buttonx)
    GUI.Hide (Buttonx)
    GUI.Disable (Buttonx)
end Button1
body proc Button2
    cls
    var Buttony : int := GUI.CreateButtonFull (maxx div 2 - 250, maxy div 2 - 50, 500, "Button2", End, 100, 's', true)
    loop
        exit when GUI.ProcessEvent
    end loop
end Button2
Button1


-----------------------------------
Tony
Sat May 03, 2014 2:30 pm

Re: Turing GUI Buttons Won't Clear
-----------------------------------
I made this sample to show you the most basic form of my problem.

This is the best way to get help with figuring out problems.


    loop
        exit when GUI.ProcessEvent
    end loop
    GUI.Dispose (Buttonx)
]
Here, GUI.Dispose is positioned after an infinite loop. The loop will not exit until GUI.Quit is called (See 
loop
  if  then
    % do stuff
  elsif  then
    exit
  elsif GUI.ProcessEvent then
    % handle GUI.Quit
  end if
end loop


-----------------------------------
ocaber12
Wed Dec 09, 2015 7:33 pm

RE:Turing GUI Buttons Won\'t Clear
-----------------------------------
how do I have multiple buttons on one screen?

-----------------------------------
Insectoid
Wed Dec 09, 2015 10:59 pm

RE:Turing GUI Buttons Won\'t Clear
-----------------------------------
Just create more than one button. Use GUI.CreateButton twice to get two different buttons.
