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
%TBN_FIRST = 0-700
%TBN_DRAGOVER = %TBN_FIRST - 27
Global hDlg,hToolbar,hLst As Dword 'main dialog handle
Global StartItem, EndItem As Dword
Function PBMain()
Dialog New Pixels, 0, "Toolbar Test",,, 500,250, %WS_SysMenu, To hDlg
Control Add Toolbar, hDlg, 500,"", 0,0,0,0, %WS_Child Or %WS_Visible Or %WS_Border Or %CCS_Top Or %TbStyle_Flat Or %CCS_Adjustable
Toolbar Add Button hDlg, %IDC_Toolbar, 0, 200, %TbStyle_Button, "0"
Toolbar Add Button hDlg, %IDC_Toolbar, 0, 201, %TbStyle_Button, "1"
Toolbar Add Button hDlg, %IDC_Toolbar, 0, 202, %TbStyle_Button, "2"
Toolbar Add Button hDlg, %IDC_Toolbar, 0, 203, %TbStyle_Button, "3"
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Local NMT As NMToolbar Ptr
Select Case Cb.Msg
Case %WM_InitDialog
Reset StartItem, EndItem
Case %WM_Notify
Select Case Cb.NmId
Case %IDC_Toolbar
Select Case Cb.NmCode
Case %TBN_BeginDrag
NMT = Cb.LParam
StartItem = @NMT.iItem
'StartItem = SendMessage(hToolBar, %TB_GetHotItem, 0, 0)
Dialog Set Text hDlg, "Start: " + Str$(StartItem)
Case %TBN_DragOver
NMT = Cb.LParam
EndItem = @NMT.iItem
'EndItem = SendMessage(hToolBar, %TB_GetHotItem, 0, 0)
Dialog Set Text hDlg, "End: " + Time$ 'Str$(EndItem)
Case %TBN_EndDrag
Reset StartItem, EndItem
End Select
End Select
End Select
End Function
'gbs_00814
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm