TreeView (Node DoubleClick Event) Help!! 
Author Message
 TreeView (Node DoubleClick Event) Help!!

Hello,
  I am working on a shopping cart style program in Visual Basic. I have
a series of items that are categorized like the following:

Fruit: Apples, Oranges, Pears
Vegies: Carrots, Beans, Peas
Meats: Ham, Bacon, Sausage

I want to display these in a TreeView control, since it has the ability
to categorize items, expanding and collapsing those items you want to
see. My problem is, I want the user to add an item to a shopping cart by
double clicking on the actual item to purchase (Apples, Carrtots, etc).
The Treeview only seems to support a NodeClick event and not a
NodeDblClick event. Is there a way to implement a double-clicking to
choose event within the current TreeView. If not, is there one available
that supports this and if not, is it difficult to create my own ActiveX
control based on the TreeView just to implement this one event? Any help
would be greatly appreciated!
  Thanks,
   John Bellando



Sat, 18 Aug 2001 03:00:00 GMT  
 TreeView (Node DoubleClick Event) Help!!
Hi John.  How about the following:

Private m_AllowTVWDBLClick As Boolean

Private Sub TreeView1_MouseDown(Button As Integer, _
Shift As Integer, x As Single, y As Single)
If Not TreeView1.HitTest(x, y) Is Nothing Then
'allow legit double click
m_AllowTVWDBLClick = True
Else
'don't allow it
m_AllowTVWDBLClick = False
End If
End Sub

Private Sub TreeView1_DblClick()
Debug.Print "TreeView1_DblClick"
If m_AllowTVWDBLClick = True Then
'use treeview1 selecteditem
Debug.Print TreeView1.SelectedItem.Text
Else
'not a legit double click on an item
End If
End Sub

'--------
galen


Quote:
>Hello,
>  I am working on a shopping cart style program in Visual Basic. I have
>a series of items that are categorized like the following:

>Fruit: Apples, Oranges, Pears
>Vegies: Carrots, Beans, Peas
>Meats: Ham, Bacon, Sausage

>I want to display these in a TreeView control, since it has the ability
>to categorize items, expanding and collapsing those items you want to
>see. My problem is, I want the user to add an item to a shopping cart by
>double clicking on the actual item to purchase (Apples, Carrtots, etc).
>The Treeview only seems to support a NodeClick event and not a
>NodeDblClick event. Is there a way to implement a double-clicking to
>choose event within the current TreeView. If not, is there one available
>that supports this and if not, is it difficult to create my own ActiveX
>control based on the TreeView just to implement this one event? Any help
>would be greatly appreciated!
>  Thanks,
>   John Bellando



Sat, 18 Aug 2001 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. Collapse of Treeview Node Raises Unwanted NodeCheck Event

4. Reset selected node in treeview item_click event

5. Treeview: highlight node with control Click event

6. Treeview node Click event?

7. TreeView Node GotFocus Event?

8. TreeView node double-click event?

9. Treeview selects node before events fire (Bug?)

10. Tree control: doubleclicking a node to show a form

11. treeview node count not incrementing when adding new nodes

12. treeview - Move node, insert node

 

 
Powered by phpBB® Forum Software