Date: 02-16-2022
Return to Index
created by gbSnippets
Compilable Example:
'Compilable Example: (Jose Includes)
#Compiler PBWin 10
#Compile Exe
#Dim All
%Unicode = 1
#Include "Win32API.inc"
%IDC_Button = 500
%IDC_Toolbar = 501
Global hDlg,hFloating As Dword
Function PBMain() As Long
Local i As Long
Dialog New Pixels, 0, "PowerBASIC",300,300,360,120, %WS_OverlappedWindow To hDlg
Control Add Button, hDlg, %IDC_Button,"Push", 50,70,100,20
Dialog Show Modal hDlg Call DlgProc
End Function
CallBack Function DlgProc() As Long
Static i,iOld As Long
Select Case Cb.Msg
Case %WM_InitDialog
DisplayFloatingToolbar
Case %WM_Command
Select Case Cb.Ctl
Case %IDC_Button
Incr i : iOld = i-1 ' <- need to be here
If i > 10 Then i = 1
Control Send hFloating, %IDC_Toolbar, %TB_CHECKBUTTON, 700+i, 1
If iOld Then Control Send hFloating, %IDC_Toolbar, %TB_CHECKBUTTON, 700+iOld, 0
End Select
End Select
End Function
Sub DisplayFloatingToolbar
Local i As Long
Dialog New Pixels, hDlg, "Floating Toolbar",300,100,220,96,%WS_SysMenu Or %WS_ClipSiblings Or %WS_ClipChildren To hFloating
Control Add Toolbar, hFloating, %IDC_Toolbar,"", 0,0,0,0, %WS_Child Or %WS_Visible Or %TbStyle_Tooltips Or %TbStyle_Flat Or %TbStyle_Wrapable
For i = 1 To 10 : Toolbar Add Button hFloating, %IDC_Toolbar, 0, 700+i, %BTNS_CheckGroup, "Btn" + Trim$(Str$(i)) : Next i
Dialog Show Modeless hFloating
End Sub
'gbs_01231
'Date: 05-11-2013
http://www.garybeene.com/sw/gbsnippets.htm