Code: Select all
Procedure StopToolbarAutoAlign(Toolbar)
T = ToolBarID(Toolbar)
SetWindowLong_(T, #GWL_STYLE, GetWindowLong_(T, #GWL_STYLE) | #CCS_NODIVIDER)
SetWindowLong_(T, #GWL_STYLE, GetWindowLong_(T, #GWL_STYLE) | #CCS_NOPARENTALIGN)
SetWindowLong_(T, #GWL_STYLE, GetWindowLong_(T, #GWL_STYLE) | #CCS_NORESIZE)
EndProcedure
Procedure MakeToolbarVertical(Toolbar)
Protected Count
Protected hTB = ToolBarID(Toolbar)
SetWindowLong_(hTB, #GWL_STYLE, GetWindowLong_(hTB, #GWL_STYLE) | #TBSTYLE_WRAPABLE | #CCS_NOPARENTALIGN)
Count = SendMessage_(hTB, #TB_BUTTONCOUNT, 0, 0)
SendMessage_(hTB, #TB_SETROWS, Count | 1 << 16, @tbr.RECT)
EndProcedure
OpenWindow(0, 0, 0, 512, 384, "", #PB_Window_ScreenCentered | #PB_Window_SystemMenu)
CreateGadgetList(WindowID(0))
CreateToolBar(0, WindowID(0))
ToolBarStandardButton(0, 0)
ToolBarStandardButton(0, 1)
ToolBarStandardButton(0, 2)
ToolBarStandardButton(0, 3)
StopToolbarAutoAlign(0)
T = ToolBarID(0)
MoveWindow_(ToolBarID(0), 0, 100, 512, 22, 1)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
EndSelect
ForEver
Code: Select all
Procedure ToolbarX(Toolbar)
GetWindowRect_(ToolBarID(Toolbar), @R.RECT)
W = GetParent_(ToolBarID(Toolbar))
ScreenToClient_(W, @R)
ProcedureReturn R\left
EndProcedure
Procedure ToolbarY(Toolbar)
GetWindowRect_(ToolBarID(Toolbar), @R.RECT)
W = GetParent_(ToolBarID(Toolbar))
ScreenToClient_(W, @R)
ProcedureReturn R\top
EndProcedure
Procedure ToolbarR(Toolbar)
GetWindowRect_(ToolBarID(Toolbar), @R.RECT)
W = GetParent_(ToolBarID(Toolbar))
ScreenToClient_(W, @R+8)
ProcedureReturn R\Right
EndProcedure
Procedure ToolbarB(Toolbar)
GetWindowRect_(ToolBarID(Toolbar), @R.RECT)
W = GetParent_(ToolBarID(Toolbar))
ScreenToClient_(W, @R+8)
ProcedureReturn R\Bottom
EndProcedure
Procedure ToolbarButtonSize(Toolbar, *S.SIZE)
SendMessage_(ToolBarID(Toolbar), #TB_GETITEMRECT, 0, @R.RECT)
*S\cx = R\right-r\left
*S\cy = R\bottom-r\top
EndProcedure