Date: 02-16-2022
Return to Index
created by gbSnippets
'Compilable Example: (Jose Includes)
#Compiler PBWin 9, PBWin 10
#Compile EXE
#Dim All
%Unicode=1
#Include "Win32API.inc"
#include "commctrl.inc"
%IDC_Toolbar = 500
%IDT_New = 501
%IDT_Open = 502
%IDC_Label = 503
Global hDlg, hToolbarDlg, hLst As Dword
Function PBMain()
Dialog New Pixels, 0, "Fixed Width Toolbar",,, 250,100, %WS_SysMenu, To hDlg
Control Add Label, hDlg, %IDC_Label, "Visible label text ... ", 110,10,100,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Select Case Cb.Msg
Case %WM_InitDialog
CreateToolbarDialog
Case %WM_Destroy
Dialog End hToolbarDlg
End Select
End Function
Sub CreateToolbarDialog
Dialog New Pixels, hDlg, "",0,0,75,40, %WS_Popup Or %WS_Child To hToolbarDlg
Control Add Toolbar, hToolbarDlg, %IDC_Toolbar,"", 0,0,0,0, %TbStyle_Flat
'add standard bitmaps to imagelist
Dim BMP As TBADDBITMAP
BMP.hInst = %HINST_COMMCTRL
BMP.nID = %IDB_STD_SMALL_COLOR
Control Send hToolbarDlg, %IDC_Toolbar, %TB_ADDBITMAP, 0, VarPtr(BMP)
'create buttons
Toolbar Add Button hToolbarDlg, %IDC_Toolbar, %STD_FILENEW+1, %IDT_New, %TbStyle_Button, "New"
Toolbar Add Button hToolbarDlg, %IDC_Toolbar, %STD_FILEOPEN+1, %IDT_Open, %TbStyle_Button, "Open"
Dialog Show Modeless hToolbarDlg Call ToolbarProc
End Sub
CallBack Function ToolbarProc() As Long
Select Case Cb.Msg
Case %WM_Command
Select Case Cb.Ctl
Case %IDT_New : ? "new"
Case %IDT_Open : ? "open"
End Select
End Select
End Function
'gbs_01120
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm