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:
'Credit: Dominic Mitchell
'Two TOP-most toolbars:
'The trick is to have the 2nd TOP Toolbar not position itself over the
'first TOP toolbar. The %CCS_NoMoveY styles does this.
Control Add Toolbar, hDlg, 600,"", 0,40,0,0, %CCS_NoMoveY Or %TbStyle_Flat Or %WS_Border Or %WS_Child
'Compilable Example: (Jose Includes)
'Credit Dominic Mitchell
#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
Control Add Toolbar, hDlg, 600,"", 0,40,0,0, %CCS_NoMoveY Or %TbStyle_Flat Or %WS_Border Or %WS_Child
'create buttons
For i = 1 To 5
Toolbar Add Button hDlg, 500, 1, 200+1, %TbStyle_Button, "x"
Next i
For i = 1 To 5
Toolbar Add Button hDlg, 600, 1, 300+1, %TbStyle_Button, "x"
Next i
Dialog Show Modal hDlg
End Function
'gbs_00567
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm