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"
%IDM_Right = 500
%IDM_Left = 501
%IDM_Up = 502
%IDM_Down = 503
Global hdlg As Dword
Function PBMain()
Dialog New Pixels, 0, "arrow test",300,300,500,350, %WS_OverlappedWindow Or %WS_ClipChildren To hDlg
BuildAcceleratorTable
Dialog Show Modal hDlg Call DlgProc()
End Function
CallBack Function DlgProc() As Long
Select Case Cb.Msg
Case %WM_Command
Select Case Cb.Ctl
Case %IDM_Left : Dialog Set Text hDlg, "Left"
Case %IDM_Right : Dialog Set Text hDlg, "Right"
Case %IDM_Up : Dialog Set Text hDlg, "Up"
Case %IDM_Down : Dialog Set Text hDlg, "Down"
End Select
End Select
End Function
Sub BuildAcceleratorTable
Local c As Long, ac() As ACCELAPI, hAccelerator As Dword ' for keyboard accelator table values
Dim ac(3)
ac(c).fvirt = %FVIRTKEY : ac(c).key = %VK_Left : ac(c).cmd = %IDM_Left : Incr c
ac(c).fvirt = %FVIRTKEY : ac(c).key = %VK_Right : ac(c).cmd = %IDM_Right : Incr c
ac(c).fvirt = %FVIRTKEY : ac(c).key = %VK_Up : ac(c).cmd = %IDM_Up : Incr c
ac(c).fvirt = %FVIRTKEY : ac(c).key = %VK_Down : ac(c).cmd = %IDM_Down : Incr c
Accel Attach hDlg, AC() To hAccelerator
End Sub
'gbs_00980
'Date: 03-10-2012
http://www.garybeene.com/sw/gbsnippets.htm