I now have need of keyboard input into my program and thought
I'd just trap the WM_KEYUP key. What I want to do is just get
all keys for a given dialog, passing most of them on and
acting on a few. I don't need to have the keyboard input just
for the button that has the focus, but I'd like to learn how
to do that as well. And down the road I'd like to peek at
the keys before they are given to a TEXT EDIT control.
I thought this should work. It doesn't. There must be some
setup required!?
--------------------------------------------------------------
#COMPILE EXE
#REGISTER NONE
$INCLUDE "WIN32API.INC"
GLOBAL Speeds() AS STRING
GLOBAL hDlg AS LONG
CALLBACK FUNCTION CBIndex()
SELECT CASE CBMSG
CASE %WM_KEYUP
MSGBOX"Hi there"
END SELECT
END FUNCTION
FUNCTION PBMAIN()
DIM Speeds(5:49) AS STRING
FOR i&=5 TO 49:speeds(i&)=" "+RIGHT$(STR$(100+i&),2)+" ":NEXT
DIALOG NEW 0,"Morse Academy",,,320,240,_
%WS_CAPTION OR %WS_SYSMENU OR %WS_THICKFRAME OR %WS_MAXIMIZEBOX OR _
%WS_MINIMIZEBOX OR %DS_CONTEXTHELP,0 TO hDlg
IF hDlg=0 THEN EXIT FUNCTION ' Error occurred
CONTROL ADD COMBOBOX,hDlg,200,Speeds(),10,10,80,110,_
%CBS_DROPDOWNLIST OR %LBS_WANTKEYBOARDINPUT CALL CBIndex()
COMBOBOX SELECT hDlg,200,5
DIALOG SHOW MODAL hDlg, CALL CBIndex()
END FUNCTION
I'd just trap the WM_KEYUP key. What I want to do is just get
all keys for a given dialog, passing most of them on and
acting on a few. I don't need to have the keyboard input just
for the button that has the focus, but I'd like to learn how
to do that as well. And down the road I'd like to peek at
the keys before they are given to a TEXT EDIT control.
I thought this should work. It doesn't. There must be some
setup required!?
--------------------------------------------------------------
#COMPILE EXE
#REGISTER NONE
$INCLUDE "WIN32API.INC"
GLOBAL Speeds() AS STRING
GLOBAL hDlg AS LONG
CALLBACK FUNCTION CBIndex()
SELECT CASE CBMSG
CASE %WM_KEYUP
MSGBOX"Hi there"
END SELECT
END FUNCTION
FUNCTION PBMAIN()
DIM Speeds(5:49) AS STRING
FOR i&=5 TO 49:speeds(i&)=" "+RIGHT$(STR$(100+i&),2)+" ":NEXT
DIALOG NEW 0,"Morse Academy",,,320,240,_
%WS_CAPTION OR %WS_SYSMENU OR %WS_THICKFRAME OR %WS_MAXIMIZEBOX OR _
%WS_MINIMIZEBOX OR %DS_CONTEXTHELP,0 TO hDlg
IF hDlg=0 THEN EXIT FUNCTION ' Error occurred
CONTROL ADD COMBOBOX,hDlg,200,Speeds(),10,10,80,110,_
%CBS_DROPDOWNLIST OR %LBS_WANTKEYBOARDINPUT CALL CBIndex()
COMBOBOX SELECT hDlg,200,5
DIALOG SHOW MODAL hDlg, CALL CBIndex()
END FUNCTION
Comment