Is it possible to change the orientation of a panelgadget in the same way as with a VB Tabstrip? Or is this one for the WishList?
For Example;
Cheers ...
Code: Select all
#TCS_SCROLLOPPOSITE = $1
#TCS_BOTTOM = $2
#TCS_RIGHT = $2
#TCS_MULTISELECT = $4
#TCS_FLATBUTTONS = $8
#TCS_FORCEICONLEFT = $10
#TCS_FORCELABELLEFT = $20
#TCS_HOTTRACK = $40
#TCS_VERTICAL = $80
#TCS_MULTILINE = $200
Procedure SetStyle(Handle, style.l)
SetWindowLong_(Handle, #GWL_STYLE, GetWindowLong_(Handle, #GWL_STYLE) | style)
EndProcedure
OpenWindow(0, 300, 300, 300, 300, #PB_Window_SystemMenu, "Tab test", 0)
CreateGadgetList(WindowID())
PanelGadget(0, 0, 0, 300, 300)
For i = 1 To 9
AddGadgetItem(0, i - 1, "Onglet " + Str(i))
Next
CloseGadgetList()
SetStyle(GadgetID(0),#TCS_MULTILINE)
SetGadgetState(0,0)
Repeat : Until WaitWindowEvent()=#WM_CLOSE
Code: Select all
#TCS_TABS = 0
#TCS_BOTTOM = 2 ; Place tabs on bottom
#TCS_RIGHT = 2 ; Place tabs on right
#TCS_FLATBUTTONS = 8
#TCS_VERTICAL = $80 ; Place tabs on left
#TCS_BUTTONS = $100
#TCS_MULTILINE = $200 ; Required if using #TCS_VERTICAL
#Panel_0 = 100
Enumeration
#Container_0
#Container_1
#Button_0
#Button_1
#ExplorerList_0
#ExplorerTree_0
EndEnumeration
Procedure myWindowCallback(hwnd, msg, wparam, lparam)
Shared tabToHideID
result = #PB_ProcessPureBasicEvents
Select msg
Case #WM_NOTIFY
*pnmhdr.NMHDR = lparam
If *pnmhdr\code = #TCN_SELCHANGING
*ptcnmhdr.NMHDR = lparam
; --> Get Tab that is losing focus (this ID = #Container_0 or #Container_1)
tabToHideID = SendMessage_(*ptcnmhdr\hwndFrom, #TCM_GETCURSEL, 0, 0)
EndIf
If *pnmhdr\code = #TCN_SELCHANGE
*ptcnmhdr.NMHDR = lparam
; --> Get Tab that is gaining focus (this ID = #Container_0 or #Container_1)
tabToShowID = SendMessage_(*ptcnmhdr\hwndFrom, #TCM_GETCURSEL, 0, 0)
If *ptcnmhdr\idFrom = #Panel_0
; --> Show / hide tab contents
HideGadget(tabToShowID, 0)
HideGadget(tabToHideID, 1)
EndIf
EndIf
EndSelect
ProcedureReturn result
EndProcedure
If OpenWindow(0, 0, 0, 400, 200,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"Sparkies Custom PanelGadget") And CreateGadgetList(WindowID(0))
SetWindowCallback(@myWindowCallback())
panelX = 10
panelY = 10
panelW = WindowWidth() - 20
panelH = WindowHeight() - 20
; --> Define style and create PanelGadget()
; --> To use standard tabs
tcStyle = #TCS_TABS | #TCS_MULTILINE | #TCS_VERTICAL
; --> To use buttons
;tcStyle = #TCS_BUTTONS | #TCS_MULTILINE | #TCS_VERTICAL
; --> To use flat buttons
;tcStyle = #TCS_FLATBUTTONS | #TCS_BUTTONS | #TCS_MULTILINE | #TCS_VERTICAL
hPanel = CreateWindowEx_(#WS_EX_LEFT | #WS_EX_LTRREADING | #WS_EX_RIGHTSCROLLBAR, "SysTabControl32", "PanelGadget1", #WS_OVERLAPPED | #WS_CHILD | #WS_VISIBLE | #WS_CLIPSIBLINGS | #WS_GROUP | #WS_TABSTOP | tcStyle, panelX, panelY, panelW, panelH, WindowID(), #Panel_0, GetModuleHandle_(0) , 0)
; --> Load and set font to use for tabs (optional)
tabFont = LoadFont(0, "Arial", 10, #PB_Font_Bold)
SendMessage_(hPanel, #WM_SETFONT, tabFont, 1)
pgadItem.TC_ITEM
; --> init Tab #1
tabText1$ = "Tab #1"
pgadItem\mask = #TCIF_TEXT
pgadItem\pszText = @tabText1$
pgadItem\cchTextMax = Len(tabText1$)
; --> Insert tab #1
SendMessage_(hPanel, #TCM_INSERTITEM, #Container_0, pgadItem)
; Get rect for tab for placement of our ContainerGadgets to follow
SendMessage_(hPanel, #TCM_GETITEMRECT, #Container_0, @tcRect.RECT)
; --> Need to work on a better placement formula, but this seems to work for now
ContainerGadget(#Container_0, panelX+(tcRect\right-tcRect\left)+3, panelY+tcRect\top, panelW-(tcRect\right-tcRect\left)-6, panelH-6)
; --> Add some gadgets to Tab #1 (#Conatiner_0 is parent)
ButtonGadget(#Button_0, 100, 10, 120, 20, "Hello, we are in Tab #1")
ExplorerListGadget(#ExplorerList_0, 10, 35, 330, 120, "c:\")
CloseGadgetList()
; --> init Tab #2
tabText2$ = "Tab #2"
pgadItem\mask = #TCIF_TEXT
pgadItem\pszText = @tabText2$
pgadItem\cchTextMax = Len(tabText2$)
SendMessage_(hPanel, #TCM_INSERTITEM, #Container_1, pgadItem)
; --> Need to work on a better placement formula, but this seems to work for now
ContainerGadget(#Container_1, panelX+(tcRect\right-tcRect\left)+3, panelY+tcRect\top, panelW-(tcRect\right-tcRect\left)-6, panelH-6)
; --> Add some gadgets to Tab #1 (#Conatiner_1 is parent)
ButtonGadget(#Button_1, 100, 10, 120, 20, "Hello, we are in Tab #2")
ExplorerTreeGadget(#ExplorerTree_0, 10, 35, 330, 120, "c:\")
CloseGadgetList()
; --> We start off in Tab #1 so we hide Tab #2 contents (#Container_1)
HideGadget(#Container_1, 1)
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
EndIf
End
Code: Select all
#TCS_BOTTOM = 2
#TCS_RIGHT = 2
#TCS_VERTICAL = $80
If OpenWindow(0,0,0,322,220,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"PanelGadget") And CreateGadgetList(WindowID(0))
hPgad = PanelGadget(0,8,8,306,203)
AddGadgetItem (0,-1,"Panel 1")
AddGadgetItem (0,-1,"Panel 2")
ButtonGadget(2, 10, 15, 80, 24,"Button 1")
ButtonGadget(3, 95, 15, 80, 24,"Button 2")
CloseGadgetList()
SetWindowLong_(GadgetID(0), #GWL_STYLE, GetWindowLong_(GadgetID(0), #GWL_STYLE) | #TCS_BOTTOM)
pgStatic1 = FindWindowEx_(hPgad, 0, "Static", 0)
MoveWindow_(pgStatic1, 0, 0, 260, 180, 1)
pgStatic2 = FindWindowEx_(hPgad, pgStatic1, "Static", 0)
MoveWindow_(pgStatic2, 0, 0, 260, 180, 1)
Repeat : Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
Code: Select all
#TCS_BOTTOM = 2
#TCS_RIGHT = 2
#TCS_VERTICAL = $80
If OpenWindow(0,0,0,322,220,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"PanelGadget") And CreateGadgetList(WindowID(0))
hPgad = PanelGadget(0,8,8,306,203)
AddGadgetItem (0,-1,"Panel 1")
AddGadgetItem (0,-1,"Panel 2")
AddGadgetItem (0,-1,"Panel 3")
AddGadgetItem (0,-1,"Panel 4")
ButtonGadget(2, 10, 15, 80, 24,"Button 1")
ButtonGadget(3, 95, 15, 80, 24,"Button 2")
CloseGadgetList()
SetWindowLong_(GadgetID(0), #GWL_STYLE, GetWindowLong_(GadgetID(0), #GWL_STYLE) | #TCS_BOTTOM)
Repeat
pgStatic1 = FindWindowEx_(hPgad, 0, "Static", 0)
MoveWindow_(pgStatic1, 0, 0, 260, 180, 1)
pgStatic2 = FindWindowEx_(hPgad, pgStatic1, "Static", 0)
MoveWindow_(pgStatic2, 0, 0, 260, 180, 1)
pgStatic3 = FindWindowEx_(hPgad, pgStatic2, "Static", 0)
MoveWindow_(pgStatic3, 0, 0, 260, 180, 1)
pgStatic4 = FindWindowEx_(hPgad, pgStatic3, "Static", 0)
MoveWindow_(pgStatic4, 0, 0, 260, 180, 1)
Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf
Code: Select all
#TCS_BOTTOM = 2
#TCS_RIGHT = 2
#TCS_VERTICAL = $80
If OpenWindow(0,0,0,322,220,#PB_Window_SystemMenu|#PB_Window_ScreenCentered,"PanelGadget") And CreateGadgetList(WindowID(0))
hPgad = PanelGadget(0,8,8,306,203)
AddGadgetItem (0,-1,"Panel 1")
AddGadgetItem (0,-1,"Panel 2")
AddGadgetItem (0,-1,"Panel 3")
AddGadgetItem (0,-1,"Panel 4")
ButtonGadget(2, 10, 15, 80, 24,"Button 1")
ButtonGadget(3, 95, 15, 80, 24,"Button 2")
CloseGadgetList()
SetWindowLong_(GadgetID(0), #GWL_STYLE, GetWindowLong_(GadgetID(0), #GWL_STYLE) | #TCS_BOTTOM)
Repeat
pgStatic = 0
For i = 1 To CountGadgetItems(0)
pgStatic = FindWindowEx_(hPgad, pgStatic, "Static", 0)
MoveWindow_(pgStatic, 0, 0, 260, 180, 1)
Next i
Until WaitWindowEvent()=#PB_Event_CloseWindow
EndIf