
Give ToolBarHeight() a brother named ToolBarWidth()
- Michael Vogel
- Addict
- Posts: 2797
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Give ToolBarHeight() a brother named ToolBarWidth()
I would like to have that function 

Euh, why? Isn't that the same as WindowWidth()?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
- Fluid Byte
- Addict
- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
It is unless you change the auto sizing via API. So this request is rather pointless 

Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
- Michael Vogel
- Addict
- Posts: 2797
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
It would make things easier...
Code: Select all
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
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
OpenWindow(0,0,0,512,140,"",#PB_Window_ScreenCentered | #PB_Window_SystemMenu)
ListIconGadget(17,20,20,200,200,"Just for testing",99)
DisableGadget(17,1)
CreateToolBar(0,WindowID(0))
ToolBarStandardButton(0,0,#PB_ToolBar_Toggle)
ToolBarSeparator()
ToolBarStandardButton(1,1,#PB_ToolBar_Toggle)
ToolBarStandardButton(2,2,#PB_ToolBar_Toggle)
ToolBarStandardButton(3,3,#PB_ToolBar_Toggle)
If #True
T=ToolBarID(0)
Global s.SIZE
ToolbarButtonSize(0,@s)
height=s\cy
width=s\cx*4
Else
height=ToolBarHeight(0)
width=ToolBarWidth(0)
EndIf
ButtonGadget(18,26,6,width+4,height+4,"")
DisableGadget(18,1)
StopToolbarAutoAlign(0)
modus=#SW_SHOW
SetWindowPos_(ToolBarID(0),GadgetID(18),28,8,width,height,#SWP_DRAWFRAME)
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow
Break
Case #WM_CHAR
modus=#SW_SHOW-modus
ShowWindow_(GadgetID(18),modus)
ShowWindow_(ToolBarID(0),modus)
Default
Debug GetToolBarButtonState(0,1)
EndSelect
ForEver
- Fluid Byte
- Addict
- Posts: 2336
- Joined: Fri Jul 21, 2006 4:41 am
- Location: Berlin, Germany
You don't quite understand. You are mixing native PB commands with API. You use the API to modify the behaviour of the toolbar. By default PB toolbars always are as wide as the width of it's parent window. That is why there is no such command.
Windows 10 Pro, 64-Bit / Whose Hoff is it anyway?
- Michael Vogel
- Addict
- Posts: 2797
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
You're right, of course... maybe I've thought to start to get just one simple command for now and then I can try to get some other functions (SetToolBarPosition() etc.) implemented to get floating toolbars alsoFluid Byte wrote:You don't quite understand. You are mixing native PB commands with API. You use the API to modify the behaviour of the toolbar. By default PB toolbars always are as wide as the width of it's parent window. That is why there is no such command.
