SBendBuckeye
Programmer
Hello All,
I have a class which is checking some things on the parent form using with events as shown in the skeleton below:
The problems I have are as follow:
1. The KeyUp event does not trap the Tab key. If I put a breakpoint in the code, it is entered for all the rest of the keys but is never fired for the Tab key.
2. In the above code I use ActiveControl to determine which control has the focus. With the exception of the Tab key problem noted above, it is working well for keyboard entry. But, how do I handle mouse entry (eg user clicks in a listbox to select an item and then clicks on another control)? I thought there was a vbKey for the left mouse button but if there is, I missed it.
3. Can I use a generic mouse event in a similar manner to the KeyUp processing above? If so, is there some kind of correspondingpreview property I need to set to activate it? How do I determine which control has the focus in such a case?
Thanks in advance for any ideas, suggestions or best of all, a working code example to point me in the right direction!
Have a great day!
j2consulting@yahoo.com
I have a class which is checking some things on the parent form using with events as shown in the skeleton below:
Code:
Private WithEvents mfrmParent As Form
Public Property ParentForm(Value As Form)
Set mfrmParent = Value
mfrmParent.KeyPreview = True
End Property
Private Sub mfrmParent_KeyUp(etc)
If KeyCode = vbKeyReturn Then
'Do Something
End If
End Sub
1. The KeyUp event does not trap the Tab key. If I put a breakpoint in the code, it is entered for all the rest of the keys but is never fired for the Tab key.
2. In the above code I use ActiveControl to determine which control has the focus. With the exception of the Tab key problem noted above, it is working well for keyboard entry. But, how do I handle mouse entry (eg user clicks in a listbox to select an item and then clicks on another control)? I thought there was a vbKey for the left mouse button but if there is, I missed it.
3. Can I use a generic mouse event in a similar manner to the KeyUp processing above? If so, is there some kind of correspondingpreview property I need to set to activate it? How do I determine which control has the focus in such a case?
Thanks in advance for any ideas, suggestions or best of all, a working code example to point me in the right direction!
Have a great day!
j2consulting@yahoo.com