IonicWind Software

IWBasic => GUI Central => Topic started by: billhsln on August 21, 2011, 10:45:29 PM

Title: Problem with Dialog and reading Keypress
Post by: billhsln on August 21, 2011, 10:45:29 PM
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
Title: Re: Problem with Dialog and reading Keypress
Post by: fasecero on August 23, 2011, 12:39:58 AM
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