|
-
April 16th, 2001, 12:50 PM
#1
ListView Not Responding to Tab Key
Hi everyone,
How do I recognize that a tab key is pressed when listview control has focus. I tried key press event
if Keyascii = 9 then'tab key
keyascii = 0
end if
But, this event is not triggered at all. Any help will be greatly appreciated.
Thanks,
Anna
-
April 16th, 2001, 01:12 PM
#2
Re: ListView Not Responding to Tab Key
Catching keys (tab, arrows) without subclassing is not easy.
Form_KeyDown (or Form_KeyUp) will not catch all keys always.
If form has no controls, it will work.
If you add one textbox, it will work.
If you add second textbox, it will work for arrow keys, but Tab key will be 'eaten'.
If you add few buttons, VB will allow you to use arrow keys for navigation between buttons. But then
... Form_KeyDown will not be able to catch these arrow keys.
Here is the solution - it uses one API. You will be able to catch Tab key row . If Form_KeyDown is not able to receive a key, keyCheckTab will do it.
Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Private Sub List1_LostFocus()
keyCheckTab
End Sub
Private Sub keyCheckTab()
If GetKeyState(vbKeyTab) < 0 Then
MsgBox "Tab pressed"
End If
End Sub
Iouri Boutchkine
[email protected]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|