Does anyone know if it is possible to remove the top section of a panelgadget?
What I'm looking for is a "tabless panel", in which the panels can only be changed programmatically with setGadgetState(#panel, tab)
I forgot to mention, that I'm running Windows, cross-platform is not an issue for me.
Tabless panel
Re: Tabless panel
Hi, standard Windows controls don't really support this, but try this solution I found a while ago:
Code: Select all
Procedure FlatPanelGadget(n, x, y, w, h)
ContainerGadget(3322, x, y, w, h)
PanelGadget(n, 1, -28, w, h)
CloseGadgetList()
CloseGadgetList()
SetWindowLongPtr_(GadgetID(n), #GWL_STYLE, GetWindowLongPtr_(GadgetID(n), #GWL_STYLE) | #TCS_BUTTONS|#TCS_FLATBUTTONS)
EndProcedure
OpenWindow(0, 300, 300, 500, 350, "FlatPanelGadget test", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget, 0)
FlatPanelGadget(0, 10, 10, 400, 300)
OpenGadgetList(0)
For i = 0 To 4 ;; add 5 tabs to the PanelGadget
AddGadgetItem(0, i, "Tab " + Str(i))
TextGadget(300+i, 60, 60, 100, 40, "PAGE CONTENT " + i)
ButtonGadget(200+i,1,1,200,20,"Button " + i)
Next
CloseGadgetList()
AddKeyboardShortcut(0, #PB_Shortcut_Control | #PB_Shortcut_K, 123) ;; test: Ctrl+K to show tab #2
Repeat
e = WaitWindowEvent()
Select e
Case #PB_Event_Menu
SetGadgetState(0, 2)
Case #PB_Event_CloseWindow : End
EndSelect
ForEver
Re: Tabless panel
Simple and maybe cross platform
Code: Select all
flags = #PB_Window_SystemMenu| #PB_Window_MaximizeGadget| #PB_Window_MinimizeGadget| #PB_Window_ScreenCentered | #PB_Window_SizeGadget
OpenWindow(0,0,0,400,300,"Test",Flags)
ContainerGadget(10,10,10,306,180)
PanelGadget (0, 0,-30, 306, 203)
AddGadgetItem (0, -1, "Panel 1")
PanelGadget (1, 5, 5, 290, 166)
AddGadgetItem(1, -1, "Sub-Panel 1")
AddGadgetItem(1, -1, "Sub-Panel 2")
AddGadgetItem(1, -1, "Sub-Panel 3")
CloseGadgetList()
AddGadgetItem (0, -1,"Panel 2")
ButtonGadget(2, 10, 15, 80, 24,"Button 1")
ButtonGadget(3, 95, 15, 80, 24,"Button 2")
CloseGadgetList()
CloseGadgetList()
ButtonGadget(20,10,270,60,24,"RUN")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 20
Run ! 1
If Run = 1
SetGadgetState(0,1)
Else
SetGadgetState(0,0)
EndIf
EndSelect
EndSelect
Until Quit = 1
End
Egypt my love
Re: Tabless panel
I have tried the TabBarGadget library, buy I can't figure out how to set it up like the panel gadget of PB: For example if i want multiple editorgadgets on the tabs, simply hiding/unhiding the gadgets when the tab is changed doesn't seem possible in a (flickerless) way
Re: Tabless panel
No Tabs using Windows API
Code: Select all
flags = #PB_Window_SystemMenu| #PB_Window_MaximizeGadget| #PB_Window_MinimizeGadget| #PB_Window_ScreenCentered | #PB_Window_SizeGadget
OpenWindow(0,0,0,400,300,"Test",Flags)
PanelGadget (0, 10,10, 306, 203)
AddGadgetItem (0, -1, "Panel 1")
PanelGadget (1, 5, 5, 290, 166)
AddGadgetItem(1, -1, "Sub-Panel 1")
AddGadgetItem(1, -1, "Sub-Panel 2")
AddGadgetItem(1, -1, "Sub-Panel 3")
CloseGadgetList()
AddGadgetItem (0, -1,"Panel 2")
ButtonGadget(2, 10, 15, 80, 24,"Button 1")
ButtonGadget(3, 95, 15, 80, 24,"Button 2")
CloseGadgetList()
SetWindowLongPtr_( GadgetID(0), #GWL_STYLE, GetWindowLongPtr_( GadgetID(0), #GWL_STYLE )|#TCS_FIXEDWIDTH )
SendMessage_( GadgetID(0), #TCM_SETITEMSIZE, 0, 1<<16 | 0 )
;For PanelGadget 1
;SetWindowLongPtr_( GadgetID(1), #GWL_STYLE, GetWindowLongPtr_( GadgetID(1), #GWL_STYLE )|#TCS_FIXEDWIDTH )
;SendMessage_( GadgetID(1), #TCM_SETITEMSIZE, 0, 1<<16 | 0 )
SetGadgetState(0,1)
ButtonGadget(20,10,270,60,24,"RUN")
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Quit = 1
Case #PB_Event_Gadget
Select EventGadget()
Case 20
Run ! 1
If Run = 0
SetGadgetState(0,1)
Else
SetGadgetState(0,0)
EndIf
EndSelect
EndSelect
Until Quit = 1
End
Egypt my love
Re: Tabless panel
Not directly related, but you might look at Mohsen's example of using buttons to modify panels, etc.
It may give you a few ideas.
xButtonGadget (include file, and sample file below this post)
viewtopic.php?p=555070#p555070
It may give you a few ideas.
xButtonGadget (include file, and sample file below this post)
viewtopic.php?p=555070#p555070
- It was too lonely at the top.
System : PB 6.10 Beta 9 (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem
System : PB 6.10 Beta 9 (x64) and Win Pro 11 (x64)
Hardware: AMD Ryzen 9 5900X w/64 gigs Ram, AMD RX 6950 XT Graphics w/16gigs Mem