PlanetSquires Forums

Support Forums => Other Software and Code => Topic started by: paulDiagnos on April 13, 2005, 06:29:51 AM

Title: Key down problem
Post by: paulDiagnos on April 13, 2005, 06:29:51 AM
can you tell me whats wrong with the following code.

i have a form which is mainly a tab control, and i want to capture key presses (hopefully alt T) that sort of thing. i have placed the below code in the fron form (where the tab control is) but it doesnt seem to capture any key downs.

i have also tried the code in child forms that belong to the tab but still no luck hence the post


can any one help



   Select Case wMsg
       Case %WM_KEYDOWN
          MsgBox Str$(wmsg)
   End Select
End Function
Title: Key down problem
Post by: Anonymous on April 13, 2005, 07:02:01 AM
I can't speak authoritatively on this, but is it possible that the keystroke is being sent to the tab control rather than the form?

Double-click on the tab control. This will bring up the code editor, the TCN_SELCHANGE event will be defined. Change the righthand combobox at the top of the code editor to the TCN_KEYDOWN event and that will probably give you access to keys which are being pressed.

Haven't tried this out, but that looks to be one way forward.

Andrew
Title: Key down problem
Post by: paulDiagnos on April 13, 2005, 07:05:13 AM
Your my hero

when i grow up i wanna be just like you !

yes as you can tell worked a treat :-)

can you work your magic and tell me how to do a <Alt> <a> press
Title: Key down problem
Post by: Anonymous on April 13, 2005, 08:26:07 AM
Quote from: paulDiagnoswhen i grow up i wanna be just like you !

I promise you, you don't. Well not if you want an enjoyable life anyway.

Quotecan you work your magic and tell me how to do a <Alt> <a> press

You mean to do a programmatic Alt-A? See the following article:

http://www.powerbasic.com/support/forums/Forum4/HTML/001507.html

Andrew
Title: Key down problem
Post by: Roger Garstang on April 14, 2005, 11:14:01 AM
I think he meant to capture an alt + char...which would be about the same code as just a keypress, but checking the status of the other keys...like for F5 and Ctrl+A I use:


CASE %WM_KEYDOWN
           SELECT CASE wParam
               CASE %VK_F5
                   RefreshFileList("")
                   FUNCTION = %TRUE
               CASE %VK_A
                   IF (GetKeyState(%VK_CONTROL) AND &H8000)= &H8000 THEN
                       FOR itemCount= 0 TO SendMessage(HWND_HTML_FILELIST, %LVM_GETITEMCOUNT, 0, 0) - 1
                           ms_lvi.stateMask = %LVIS_SELECTED
                           ms_lvi.State = %LVIS_SELECTED
                           SendMessage(HWND_HTML_FILELIST, %LVM_SETITEMSTATE, itemCount, VARPTR(ms_lvi))
                       NEXT itemCount
                       FUNCTION = %TRUE
                   END IF
           END SELECT