How Do you Remove Buttons?
How Do you Remove Buttons?
I have made GUI window with 4 Buttons.
IF I click on new Game then I would like have new Screen which mean I need to remove the buttons but the questions I would like to ask is How?
IF I click on new Game then I would like have new Screen which mean I need to remove the buttons but the questions I would like to ask is How?
Re: How Do you Remove Buttons?
Use FreeGadget().
Blog: Why Does It Suck? (http://whydoesitsuck.com/)
"You can disagree with me as much as you want, but during this talk, by definition, anybody who disagrees is stupid and ugly."
- Linus Torvalds
Re: How Do you Remove Buttons?
Thanks Shied
I got another questions...
What code should I do if I click on Button then new Screen come on...
for example
IF ButtonGadget()=true
FREEGADGET()
Make Tab Screen
Endif
I got another questions...
What code should I do if I click on Button then new Screen come on...
for example
IF ButtonGadget()=true
FREEGADGET()
Make Tab Screen
Endif
Re: How Do you Remove Buttons?
Use Container for your Screens:
Code: Select all
Enumeration ; gadgets
#con_SF
#btn_SF_1
#btn_SF_2
#btn_SF_3
#con_SS
#btn_SS_1
EndEnumeration
OpenWindow(0, #PB_Ignore, #PB_Ignore, 340, 100, "")
ContainerGadget(#con_SF, 0, 0, WindowWidth(0), WindowHeight(0))
ButtonGadget(#btn_SF_1, 10, 10, 150, 30, "First on Screen First")
ButtonGadget(#btn_SF_2, 170, 10, 150, 30, "Secont on Screen First")
ButtonGadget(#btn_SF_3, 100, 60, 150,30, "Next Screen")
CloseGadgetList()
ContainerGadget(#con_SS, 0, 0, WindowWidth(0), WindowHeight(0))
ButtonGadget(#btn_SS_1, 60, 30, 200, 30, "Go Back to Screen First")
CloseGadgetList()
HideGadget(#con_SS, #True)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
Select EventGadget()
Case #btn_SF_1 : Debug "First on Screen First"
Case #btn_SF_2 : Debug "Second on Screen First"
Case #btn_SF_3 : HideGadget(#con_SF, #True) : HideGadget(#con_SS, #False)
Case #btn_SS_1 : HideGadget(#con_SS, #True) : HideGadget(#con_SF, #False)
EndSelect
EndSelect
ForEverPureBasic 5.73 | SpiderBasic 2.30 | Windows 10 Pro (x64) | Linux Mint 20.1 (x64)
Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Old bugs good, new bugs bad! Updates are evil: might fix old bugs and introduce no new ones.

Re: How Do you Remove Buttons?
Thanks ts-soft
That good to learn from and I do love Select case as it is so simple
That good to learn from and I do love Select case as it is so simple
Re: How Do you Remove Buttons?
This is what I have done so far
Code: Select all
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#Button_0
#Button_1
#Button_2
#Button_3
#Text_0
EndEnumeration
;- Fonts
Global FontID1
FontID1 = LoadFont(1, "@Meiryo UI", 28)
Procedure Open_Window_0()
If OpenWindow(#Window_0, 627, 148, 600, 300, "New window ( 0 )", #PB_Window_SystemMenu | #PB_Window_TitleBar )
If createGadgetlist(WindowID(#Window_0))
ButtonGadget(#Button_0, 190, 70, 190, 40, "NEW GAME")
ButtonGadget(#Button_1, 190, 120, 190, 40, "LOAD GAME")
ButtonGadget(#Button_2, 190, 170, 190, 40, "OPTIONS")
ButtonGadget(#Button_3, 190, 220, 190, 40, "EXIT")
SetGadgetFont(#Text_0, FontID1)
EndIf
EndIf
EndProcedure
Repeat
Select WaitWindowEvent() ; << WHY Error?
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
Select EventGadget()
Case #Button_0: HideGadget(#Button_1, #True) : HideGadget(#Button_2, #False): HideGadget(#Button_3, #True)
EndSelect
EndSelect
ForEver
Re: How Do you Remove Buttons?
Without calling Open_Window_0() you have no window.Swos2009 wrote:Code: Select all
Select WaitWindowEvent() ; << WHY Error?
Without having a window, WaitWindowEvent() will
throw an error.
Greetings ... Kiffi
Hygge
Re: How Do you Remove Buttons?
Should I do this?

Code: Select all
Repeat
Select #Window_0
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
Select EventGadget()
Case #Button_0: HideGadget(#Button_1, #True) : HideGadget(#Button_2, #False): HideGadget(#Button_3, #True)
EndSelect
EndSelect
ForEver
Re: How Do you Remove Buttons?
Code: Select all
Enumeration
#Window_0
EndEnumeration
;- Gadget Constants
;
Enumeration
#Button_0
#Button_1
#Button_2
#Button_3
#Text_0
EndEnumeration
;- Fonts
Global FontID1
FontID1 = LoadFont(1, "@Meiryo UI", 28)
Procedure Open_Window_0()
If OpenWindow(#Window_0, 627, 148, 600, 300, "New window ( 0 )", #PB_Window_SystemMenu | #PB_Window_TitleBar )
ButtonGadget(#Button_0, 190, 70, 190, 40, "NEW GAME")
ButtonGadget(#Button_1, 190, 120, 190, 40, "LOAD GAME")
ButtonGadget(#Button_2, 190, 170, 190, 40, "OPTIONS")
ButtonGadget(#Button_3, 190, 220, 190, 40, "EXIT")
SetGadgetFont(#Text_0, FontID1)
EndIf
EndProcedure
Open_Window_0() ; <<< paste this
Repeat
Select WaitWindowEvent() ; << no error anymore
Case #PB_Event_CloseWindow
Break
Case #PB_Event_Gadget
Select EventGadget()
Case #Button_0: HideGadget(#Button_1, #True) : HideGadget(#Button_2, #False): HideGadget(#Button_3, #True)
EndSelect
EndSelect
ForEverHygge
Re: How Do you Remove Buttons?
Thanks Kiffi and now I understand how it work 


