March 29, 2024, 04:26:46 AM

News:

IonicWind Snippit Manager 2.xx Released!  Install it on a memory stick and take it with you!  With or without IWBasic!


Problem with Dialog and reading Keypress

Started by billhsln, August 21, 2011, 10:45:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

billhsln

I am checking for a 1 thru 6 in a dialog, but it seems my code is not catching the key press.  My Listview is what has current focus when I am trying to do the keypress.  Should I put this code in the Listview part?

I was checking for 31-37 (numeric 1-6) and 61-67 (keypad 1-6).  I added the messagebox, and it never gets run.

SUB d1_handler(),int
'===================
SELECT @MESSAGE
CASE @IDCHAR
MESSAGEBOX d1,CHR$(@CODE) + " Key Pressed","Info"
CASE @IDINITDIALOG


Thanks,
Bill
When all else fails, get a bigger hammer.

fasecero

Maybe this helps. Will work only if the listview has the focus.



''''''''''''''''
TYPE NMHDR
INT hwndFrom
INT idfrom
INT code
ENDTYPE

TYPE LVKEYDOWN
  NMHDR hdr
  WORD  wVKey
  UINT  flags
ENDTYPE

pointer pkeyd : SETTYPE pkeyd, LVKEYDOWN
''''''''''''''''

CONST LISTVIEW_1 = 1
DIALOG d1
CREATEDIALOG d1,0,0,441,274,0x80C80080,0,"Caption",&d1_handler
CONTROL d1,@LISTVIEW,"",46,11,281,225,0x50000001,LISTVIEW_1

DOMODAL d1

SUB d1_handler
SELECT @MESSAGE
CASE @IDINITDIALOG
CENTERWINDOW d1
/* Initialize any controls here */
CASE @IDCLOSEWINDOW
CLOSEDIALOG d1,@IDOK
CASE @IDCONTROL
SELECT @CONTROLID
CASE LISTVIEW_1
/* respond to control notifications here */
SELECT @NOTIFYCODE
CASE @LVNKEYDOWN
pkeyd = *<LVKEYDOWN>@QUAL
MESSAGEBOX d1, STR$(#pkeyd.wVKey) + " Key Pressed", "Info"
ENDSELECT
ENDSELECT
ENDSELECT
RETURN
ENDSUB