|
-
October 14th, 2002, 01:33 PM
#3
Thanks, you gave me an idea.
I made a boolean and in the treeview gotfocus, I set it to true then in the lostfocus, set it to false
In the usercontrol_KeyUp (KeyPress doesn't work) event, test if the boolean is true then call the treeview_keypress event.
Works good in the sample code, now I am implementing it to the real control and see if there is any side effect for setting the Usercontrol.KeyPreview to True.
The changes I made in the sample program are as follows: set UserControl.KeyPreview to True then add all statements below.
Private mblnFocusOnTreeview As Boolean
Private Sub TreeView1_GotFocus()
mblnFocusOnTreeview = True
End Sub
Private Sub TreeView1_KeyPress(KeyAscii As Integer)
Debug.Print "tree" & KeyAscii
End Sub
Private Sub TreeView1_LostFocus()
mblnFocusOnTreeview = False
End Sub
Private Sub UserControl_KeyUp(KeyCode As Integer, Shift As Integer)
Debug.Print "control" & KeyCode
If mblnFocusOnTreeview Then Call TreeView1_KeyPress(KeyCode)
End Sub
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
|