Treeview node Click event? 
Author Message
 Treeview node Click event?

In a treeview node click event, how can I get it to run when mouse click
on it or when selected and enter button pressed?
(At the moment it runs even if highlight it with keyboard without enter)


Fri, 19 Jul 2002 03:00:00 GMT  
 Treeview node Click event?
To detect if node was clicked you have to do following in
Treeview1_MouseDown

'NewNode should be at least form level variable
Set NewNode = TreeView1.HitTest(x, y)
'at this point form level variable NewNode is initialized to the node that
user clicked

If you want to react when user double clicks on the node you just handle the
action in
TreeView1_DblClick accessing NewNode that was initialized in MouseDown

If you want to react when user hits Enter key then you have to
add this code to Treeview1.KeyPress

'again the NewNode is the for level variable
If KeyAscii = 32 Then
   Set NewNode = TreeView1.SelectedItem
    'you have to call a function that will react to this event
    'call the save place that you called in example above
   Call TreeView1_DblClick
   KeyAscii = 0
End If

Konrad Krupa

Quote:

>In a treeview node click event, how can I get it to run when mouse click
>on it or when selected and enter button pressed?
>(At the moment it runs even if highlight it with keyboard without enter)



Sat, 20 Jul 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. No node click event in Windows.Forms.TreeView?

2. TreeView -Click Event on Plus Sign Node

3. Treeview: highlight node with control Click event

4. TreeView node double-click event?

5. TREEVIEW Ctrl :detecting if a node has been selected/clicked

6. Right Click Treeview Doesnt Select Node

7. Access the node that was clicked on with in a TreeView control

8. Treeview - detecting click on node icons

9. Right mouse click on Treeview Node

10. Right mouse click on Treeview Node

11. TreeView - Node click cancel

12. TreeView Control and Node Click

 

 
Powered by phpBB® Forum Software