Restored from previous forum. Originally posted by ebs.
Does anyone know if you can dynamically hide and show one panel on a PanelGadget? I'm writing a program and the customer wants a "secret" panel that is only shown if the user enters a password.
If this isn't possible, can I use "AddGadgetItem()" to add a panel to an existing PanelGadget, and then add gadgets to the panel?
Help with Hiding a PanelGadget Panel
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by VPureBasic.
Hi ebs,
Here's a little snippet that will help you...
Roger
Hi ebs,
Here's a little snippet that will help you...
Code: Select all
OpenWindow( 0,0,0,300,300,#PB_Window_SystemMenu|#PB_Window_ScreenCentered|#PB_Window_Invisible,"Test" )
CreateGadgetList( WindowID( 0 ) )
OptionGadget ( 0, 10, 10, 150, 20, "Show Secret Gadget" )
OptionGadget ( 1, 10, 30, 150, 20, "Hide Secret Gadget" )
SetGadgetState( 1, 1 )
PanelGadget( 2, 10, 60, 270, 230 )
AddGadgetItem( 2,-1,"Secret" )
StringGadget( 3,10,10,100,20,"" )
ClosePanelGadget()
HideGadget ( 2,1 )
HideWindow ( 0, 0 )
Repeat
EW = WaitWindowEvent()
If EW = #PB_Event_Gadget
Select EventGadgetID()
Case 0 : HideGadget( 2, 0 )
Case 1 : HideGadget( 2, 1 )
EndSelect
EndIf
Until EW = #PB_EventCloseWindow
End
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by cor.
I think ebs means the following
viewtopic.php?t=5268">http://forums.pur ... php?t=5268
Using Windows 98 SE
Registered Purebasic
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
<a href="http://www.ready4music.com[/url]
http://www.chordplanet.com
I think ebs means the following
viewtopic.php?t=5268">http://forums.pur ... php?t=5268
Using Windows 98 SE
Registered Purebasic
--------------------------
C. de Visser
Author of Super Guitar Chord Finder
<a href="http://www.ready4music.com[/url]
http://www.chordplanet.com
-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by Kale.
maybe somthing like this:
i've no idea how you would add gadgets to the new panel? anybody?
--Kale
In love with PureBasic!
maybe somthing like this:
Code: Select all
Procedure showPanel()
AddGadgetItem(1, 2, "New Hidden Panel")
EndProcedure
Procedure hidePanel()
RemoveGadgetItem(1, 2)
EndProcedure
OpenWindow(1, 0,0,300, 300, #PB_Window_SystemMenu | #PB_Window_ScreenCentered, "")
If CreateMenu(0, WindowID())
MenuTitle("Panel")
MenuItem( 1, "Create New Panel")
MenuItem( 2, "Remove New Panel")
EndIf
CreateGadgetList(WindowID())
PanelGadget(1, 10, 10, 250, 250)
AddGadgetItem(1, 0, "Test Panel 1")
AddGadgetItem(1, 1, "Test Panel 2")
ClosePanelGadget()
Repeat
EventID.l = WaitWindowEvent()
Select EventID
Case #PB_EventMenu
Select EventMenuID()
Case 1
showPanel()
Case 2
hidePanel()
EndSelect
Case #PB_EventGadget
Select EventGadgetID()
EndSelect
EndSelect
Until ForEver
--Kale
In love with PureBasic!

-
- PureBasic Guru
- Posts: 16777133
- Joined: Tue Apr 22, 2003 7:42 pm
Restored from previous forum. Originally posted by ebs.
Kale, Roger, Cor,
Thanks for the suggestions. I figured it out by experimenting - you can add a new panel *and* put gadgets on it very easily!
All I did was:
So now I have my "secret" hidden panel that I can display when the password is entered. Thanks for the help!
Regards,
Eric
Kale, Roger, Cor,
Thanks for the suggestions. I figured it out by experimenting - you can add a new panel *and* put gadgets on it very easily!
All I did was:
Code: Select all
; show "terminal" tab
Procedure ShowTERM()
; add the TERM tab
AddGadgetItem(#Gadget_frmMain_pnlFunction,-1,"TERM")
StringGadget(#Gadget_frmMain_strUserInput,10,380,640,20,"")
ListIconGadget(#Gadget_frmMain_lstTERM,10,10,640,370,"",620)
ClosePanelGadget()
EndProcedure
Regards,
Eric
Originally posted by Kale
maybe somthing like this:i've no idea how you would add gadgets to the new panel? anybody?Code: Select all
Procedure showPanel() AddGadgetItem(1, 2, "New Hidden Panel") EndProcedure Procedure hidePanel() RemoveGadgetItem(1, 2) EndProcedure OpenWindow(1, 0,0,300, 300, #PB_Window_SystemMenu | #PB_Window_ScreenCentered, "") If CreateMenu(0, WindowID()) MenuTitle("Panel") MenuItem( 1, "Create New Panel") MenuItem( 2, "Remove New Panel") EndIf CreateGadgetList(WindowID()) PanelGadget(1, 10, 10, 250, 250) AddGadgetItem(1, 0, "Test Panel 1") AddGadgetItem(1, 1, "Test Panel 2") ClosePanelGadget() Repeat EventID.l = WaitWindowEvent() Select EventID Case #PB_EventMenu Select EventMenuID() Case 1 showPanel() Case 2 hidePanel() EndSelect Case #PB_EventGadget Select EventGadgetID() EndSelect EndSelect Until ForEver
--Kale
In love with PureBasic!![]()