Date: 02-16-2022
Return to Index
created by gbSnippets
'Toolbars can get pretty crowded, and having a lot of buttons on a toolbar
'can make a dialog wider than a programmer might desire. This snippets shows
'two ways to address the problem:
' - use two toolbars, one just below the other
' - force a toolbar to wrap at a specific point
'Primary Code:
'Wrap Toolbar At Specific Button:
'To wrap a toolbar, use the %TBState_Wrap style on a button. The toolbar
'will wrap after that button.
Toolbar Set State hDlg, 500, ByCmd 203, %TBState_Enabled Or %TBState_Wrap
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
Global hDlg As DWord 'main dialog handle
Function PBMain()
Local i As Long
Dialog New Pixels, 0, "Toolbar Test",,, 500,250, %WS_OverlappedWindow, To hDlg
Control Add Toolbar, hDlg, 500,"", 0,0,0,0
'create buttons
Toolbar Add Button hDlg, 500, 1, 201, %TbStyle_Button, "x"
Toolbar Add Button hDlg, 500, 1, 202, %TbStyle_Button, "x"
Toolbar Add Button hDlg, 500, 1, 203, %TbStyle_Button, "x"
Toolbar Add Button hDlg, 500, 1, 204, %TbStyle_Button, "x"
Toolbar Set State hDlg, 500, ByCmd 203, %TBState_Enabled Or %TBState_Wrap
Dialog Show Modal hDlg
End Function
'gbs_01146
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm