How to hide a widget/GUI (not sure what to call it)?
Author |
Message |
conbunthedestroyer
|
Posted: Mon Apr 03, 2017 5:45 pm Post subject: How to hide a widget/GUI (not sure what to call it)? |
|
|
What is it you are trying to achieve?
Hi! So I'm trying to actually hide the GUI in my run window
What is the problem you are having?
When I run it and press the mute/unmute button, it does make them inactive for a teensy bit, but it leaves a giant white rectangle, and I want to get rid of that.
Describe what you have tried to solve this problem
I've tried drawing a box over it, but it doesn't seem to work.
Post any relevant code (You may choose to attach the file instead of posting the code if it is too long)
Turing: |
import GUI
setscreen ("graphics: 900;900, nobuttonbar")
colourback (black)
cls
forward procedure unmute
forward procedure mute
forward procedure hideMute
forward procedure hideUnmute
var menuFont : int := Font.New ("castellar:30:bold")
var muteButton : int := GUI.CreateButton (maxx div 2, 750, 100, "MUTE", mute )
GUI.SetColour (muteButton, white)
var unmuteButton : int := GUI.CreateButton (maxx div 2, 700, 100, "UNMUTE", unmute )
GUI.SetColour (unmuteButton, white)
GUI.Hide (unmuteButton )
Music.PlayFileLoop ("menu.mp3")
Font.Draw ("MENU", 430, 850, menuFont, white)
%The boxes I tried to draw
body procedure hideMute
const x1 : int := GUI.GetX (muteButton )
const y1 : int := GUI.GetY (muteButton )
const width1 : int := GUI.GetWidth (muteButton )
const height1 : int := GUI.GetHeight (muteButton )
Draw.Box (x1, y1, x1 + width1 - 1, y1 + height1 - 1, black)
end hideMute
%more box drawing
body procedure hideUnmute
const x : int := GUI.GetX (unmuteButton )
const y : int := GUI.GetY (unmuteButton )
const width : int := GUI.GetWidth (unmuteButton )
const height : int := GUI.GetHeight (unmuteButton )
Draw.Box (x, y, x + width - 1, y + height - 1, black)
end hideUnmute
%the actual GUIs
body procedure mute
Music.PlayFileStop
GUI.Hide (muteButton )
const x1 : int := GUI.GetX (muteButton )
const y1 : int := GUI.GetY (muteButton )
const width1 : int := GUI.GetWidth (muteButton )
const height1 : int := GUI.GetHeight (muteButton )
Draw.Box (x1, y1, x1 + width1 - 1, y1 + height1 - 1, black)
GUI.Show (unmuteButton )
end mute
%More guis
body procedure unmute
Music.PlayFileLoop ("menu.mp3")
GUI.Hide (unmuteButton )
hideUnmute
GUI.Show (muteButton )
end unmute
loop
exit when GUI.ProcessEvent
end loop
|
Please specify what version of Turing you are using
Turing 4.1.1 for Windows |
|
|
|
|
|
Sponsor Sponsor
|
|
|
pttptppt
|
Posted: Fri Apr 07, 2017 6:58 pm Post subject: RE:How to hide a widget/GUI (not sure what to call it)? |
|
|
Im not quite sure i understand what you're trying to do but how about after the button goes inactive, just draw a Draw.FillBox of the background color over that specified area. Its not the best solution ever BUTTT, turing isnt the best either and this solution just adds 1 line to your code |
|
|
|
|
|
|
|