No node click event in Windows.Forms.TreeView? 
Author Message
 No node click event in Windows.Forms.TreeView?
I am customizing Windows.Forms.TreeView to add
functionalities. It seems however, that TreeView class
doesn't have a "node clicked" type of event. The only
thing close to it is the AfterSelect event. But it doesn't
realy meet our needs. I find it hard to believe that such
an important event is missing from the control. But I just
can't find it.

Am I missing somthing here?

(By the way I am not inheriting AxMSComctlLib.AxTreeView,
although it does have the node_clicked event, because it
gives me strange errors like "ActiveX state error..." when
I use it, and I can't figure out why)

Please help.

Lifeng



Thu, 01 Sep 2005 04:02:14 GMT  
 No node click event in Windows.Forms.TreeView?
Private Sub TreeView1_AfterSelect(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.TreeViewEventArgs) Handles TreeView1.AfterSelect

End Sub

Private Sub TreeView1_BeforeSelect(ByVal sender As Object, ByVal e As
System.Windows.Forms.TreeViewCancelEventArgs) Handles TreeView1.BeforeSelect

End Sub

Before select tells you where you were

After select tells you what is currently selected.


Quote:
> I am customizing Windows.Forms.TreeView to add
> functionalities. It seems however, that TreeView class
> doesn't have a "node clicked" type of event. The only
> thing close to it is the AfterSelect event. But it doesn't
> realy meet our needs. I find it hard to believe that such
> an important event is missing from the control. But I just
> can't find it.

> Am I missing somthing here?

> (By the way I am not inheriting AxMSComctlLib.AxTreeView,
> although it does have the node_clicked event, because it
> gives me strange errors like "ActiveX state error..." when
> I use it, and I can't figure out why)

> Please help.

> Lifeng



Thu, 01 Sep 2005 06:34:08 GMT  
 No node click event in Windows.Forms.TreeView?
Thanks for you reply.
Neither will work in the follwing scenario:
A MDI container contains 2 panles, one with a treeview in
it, the other displays different forms according to tree
nodes you select. When you select a node from the tree, a
form will open. Leave the node still selected while close
the form in the other panle. Now(the node is still
selected by the form is closed), if you want to open the
same form by clicking on the already selected node, guess
what, it won't work --  you have to click somewhere else
and click back again.

That's the difference between node_click event and
those "before" or "after"s.

Any idea?

Thanks

Quote:
>-----Original Message-----
>Private Sub TreeView1_AfterSelect(ByVal sender As

System.Object, ByVal e As
Quote:
>System.Windows.Forms.TreeViewEventArgs) Handles

TreeView1.AfterSelect
Quote:

>End Sub

>Private Sub TreeView1_BeforeSelect(ByVal sender As
Object, ByVal e As
>System.Windows.Forms.TreeViewCancelEventArgs) Handles

TreeView1.BeforeSelect
Quote:

>End Sub

>Before select tells you where you were

>After select tells you what is currently selected.



>> I am customizing Windows.Forms.TreeView to add
>> functionalities. It seems however, that TreeView class
>> doesn't have a "node clicked" type of event. The only
>> thing close to it is the AfterSelect event. But it
doesn't
>> realy meet our needs. I find it hard to believe that
such
>> an important event is missing from the control. But I
just
>> can't find it.

>> Am I missing somthing here?

>> (By the way I am not inheriting

AxMSComctlLib.AxTreeView,

- Show quoted text -

Quote:
>> although it does have the node_clicked event, because it
>> gives me strange errors like "ActiveX state error..."
when
>> I use it, and I can't figure out why)

>> Please help.

>> Lifeng

>.



Thu, 01 Sep 2005 08:19:37 GMT  
 No node click event in Windows.Forms.TreeView?
Use the Click event of the TreeView. To find what node was clicked, if any,
use the MousePosition property and GetNodeAt method.


Quote:
> Thanks for you reply.
> Neither will work in the follwing scenario:
> A MDI container contains 2 panles, one with a treeview in
> it, the other displays different forms according to tree
> nodes you select. When you select a node from the tree, a
> form will open. Leave the node still selected while close
> the form in the other panle. Now(the node is still
> selected by the form is closed), if you want to open the
> same form by clicking on the already selected node, guess
> what, it won't work --  you have to click somewhere else
> and click back again.

> That's the difference between node_click event and
> those "before" or "after"s.

> Any idea?

> Thanks
> >-----Original Message-----
> >Private Sub TreeView1_AfterSelect(ByVal sender As
> System.Object, ByVal e As
> >System.Windows.Forms.TreeViewEventArgs) Handles
> TreeView1.AfterSelect

> >End Sub

> >Private Sub TreeView1_BeforeSelect(ByVal sender As
> Object, ByVal e As
> >System.Windows.Forms.TreeViewCancelEventArgs) Handles
> TreeView1.BeforeSelect

> >End Sub

> >Before select tells you where you were

> >After select tells you what is currently selected.



> >> I am customizing Windows.Forms.TreeView to add
> >> functionalities. It seems however, that TreeView class
> >> doesn't have a "node clicked" type of event. The only
> >> thing close to it is the AfterSelect event. But it
> doesn't
> >> realy meet our needs. I find it hard to believe that
> such
> >> an important event is missing from the control. But I
> just
> >> can't find it.

> >> Am I missing somthing here?

> >> (By the way I am not inheriting
> AxMSComctlLib.AxTreeView,
> >> although it does have the node_clicked event, because it
> >> gives me strange errors like "ActiveX state error..."
> when
> >> I use it, and I can't figure out why)

> >> Please help.

> >> Lifeng

> >.



Thu, 01 Sep 2005 08:22:54 GMT  
 No node click event in Windows.Forms.TreeView?
Thank you for your reply.
But could you be more specific? How do you use the
MousePosition property and GetNodeAt method? the
TreeViewEventArgs only gives you 2 property/method: Empty
and GetType.
Quote:
>-----Original Message-----
>Use the Click event of the TreeView. To find what node

was clicked, if any,
Quote:
>use the MousePosition property and GetNodeAt method.



>> Thanks for you reply.
>> Neither will work in the follwing scenario:
>> A MDI container contains 2 panles, one with a treeview
in
>> it, the other displays different forms according to tree
>> nodes you select. When you select a node from the tree,
a
>> form will open. Leave the node still selected while
close
>> the form in the other panle. Now(the node is still
>> selected by the form is closed), if you want to open the
>> same form by clicking on the already selected node,
guess
>> what, it won't work --  you have to click somewhere else
>> and click back again.

>> That's the difference between node_click event and
>> those "before" or "after"s.

>> Any idea?

>> Thanks
>> >-----Original Message-----
>> >Private Sub TreeView1_AfterSelect(ByVal sender As
>> System.Object, ByVal e As
>> >System.Windows.Forms.TreeViewEventArgs) Handles
>> TreeView1.AfterSelect

>> >End Sub

>> >Private Sub TreeView1_BeforeSelect(ByVal sender As
>> Object, ByVal e As
>> >System.Windows.Forms.TreeViewCancelEventArgs) Handles
>> TreeView1.BeforeSelect

>> >End Sub

>> >Before select tells you where you were

>> >After select tells you what is currently selected.



>> >> I am customizing Windows.Forms.TreeView to add
>> >> functionalities. It seems however, that TreeView
class
>> >> doesn't have a "node clicked" type of event. The only
>> >> thing close to it is the AfterSelect event. But it
>> doesn't
>> >> realy meet our needs. I find it hard to believe that
>> such
>> >> an important event is missing from the control. But I
>> just
>> >> can't find it.

>> >> Am I missing somthing here?

>> >> (By the way I am not inheriting
>> AxMSComctlLib.AxTreeView,
>> >> although it does have the node_clicked event,
because it
>> >> gives me strange errors like "ActiveX state error..."
>> when
>> >> I use it, and I can't figure out why)

>> >> Please help.

>> >> Lifeng

>> >.

>.



Thu, 01 Sep 2005 09:53:07 GMT  
 No node click event in Windows.Forms.TreeView?
I guess I know how to call the method now, but it still
behave strangely. The line:
Dim oNod As {*filter*}ode = GetNodeAt(MousePosition)
Always gives me a node that's 3 positions bellow the one
clicked on. How's that?

Quote:
>-----Original Message-----
>Use the Click event of the TreeView. To find what node

was clicked, if any,
Quote:
>use the MousePosition property and GetNodeAt method.



>> Thanks for you reply.
>> Neither will work in the follwing scenario:
>> A MDI container contains 2 panles, one with a treeview
in
>> it, the other displays different forms according to tree
>> nodes you select. When you select a node from the tree,
a
>> form will open. Leave the node still selected while
close
>> the form in the other panle. Now(the node is still
>> selected by the form is closed), if you want to open the
>> same form by clicking on the already selected node,
guess
>> what, it won't work --  you have to click somewhere else
>> and click back again.

>> That's the difference between node_click event and
>> those "before" or "after"s.

>> Any idea?

>> Thanks
>> >-----Original Message-----
>> >Private Sub TreeView1_AfterSelect(ByVal sender As
>> System.Object, ByVal e As
>> >System.Windows.Forms.TreeViewEventArgs) Handles
>> TreeView1.AfterSelect

>> >End Sub

>> >Private Sub TreeView1_BeforeSelect(ByVal sender As
>> Object, ByVal e As
>> >System.Windows.Forms.TreeViewCancelEventArgs) Handles
>> TreeView1.BeforeSelect

>> >End Sub

>> >Before select tells you where you were

>> >After select tells you what is currently selected.



>> >> I am customizing Windows.Forms.TreeView to add
>> >> functionalities. It seems however, that TreeView
class
>> >> doesn't have a "node clicked" type of event. The only
>> >> thing close to it is the AfterSelect event. But it
>> doesn't
>> >> realy meet our needs. I find it hard to believe that
>> such
>> >> an important event is missing from the control. But I
>> just
>> >> can't find it.

>> >> Am I missing somthing here?

>> >> (By the way I am not inheriting
>> AxMSComctlLib.AxTreeView,
>> >> although it does have the node_clicked event,
because it
>> >> gives me strange errors like "ActiveX state error..."
>> when
>> >> I use it, and I can't figure out why)

>> >> Please help.

>> >> Lifeng

>> >.

>.



Thu, 01 Sep 2005 10:23:46 GMT  
 No node click event in Windows.Forms.TreeView?
MousePosition gives you the mouse coordinates in terms of the Screen. Use
PointToClient to convert it to position relative to your control.


Quote:
> I guess I know how to call the method now, but it still
> behave strangely. The line:
> Dim oNod As {*filter*}ode = GetNodeAt(MousePosition)
> Always gives me a node that's 3 positions bellow the one
> clicked on. How's that?

> >-----Original Message-----
> >Use the Click event of the TreeView. To find what node
> was clicked, if any,
> >use the MousePosition property and GetNodeAt method.



> >> Thanks for you reply.
> >> Neither will work in the follwing scenario:
> >> A MDI container contains 2 panles, one with a treeview
> in
> >> it, the other displays different forms according to tree
> >> nodes you select. When you select a node from the tree,
> a
> >> form will open. Leave the node still selected while
> close
> >> the form in the other panle. Now(the node is still
> >> selected by the form is closed), if you want to open the
> >> same form by clicking on the already selected node,
> guess
> >> what, it won't work --  you have to click somewhere else
> >> and click back again.

> >> That's the difference between node_click event and
> >> those "before" or "after"s.

> >> Any idea?

> >> Thanks
> >> >-----Original Message-----
> >> >Private Sub TreeView1_AfterSelect(ByVal sender As
> >> System.Object, ByVal e As
> >> >System.Windows.Forms.TreeViewEventArgs) Handles
> >> TreeView1.AfterSelect

> >> >End Sub

> >> >Private Sub TreeView1_BeforeSelect(ByVal sender As
> >> Object, ByVal e As
> >> >System.Windows.Forms.TreeViewCancelEventArgs) Handles
> >> TreeView1.BeforeSelect

> >> >End Sub

> >> >Before select tells you where you were

> >> >After select tells you what is currently selected.



> >> >> I am customizing Windows.Forms.TreeView to add
> >> >> functionalities. It seems however, that TreeView
> class
> >> >> doesn't have a "node clicked" type of event. The only
> >> >> thing close to it is the AfterSelect event. But it
> >> doesn't
> >> >> realy meet our needs. I find it hard to believe that
> >> such
> >> >> an important event is missing from the control. But I
> >> just
> >> >> can't find it.

> >> >> Am I missing somthing here?

> >> >> (By the way I am not inheriting
> >> AxMSComctlLib.AxTreeView,
> >> >> although it does have the node_clicked event,
> because it
> >> >> gives me strange errors like "ActiveX state error..."
> >> when
> >> >> I use it, and I can't figure out why)

> >> >> Please help.

> >> >> Lifeng

> >> >.

> >.



Thu, 01 Sep 2005 20:04:38 GMT  
 No node click event in Windows.Forms.TreeView?
Thank you so much for your help Martin! That's exactly
what I wanted. You'r such a genius! :)

Honestly, I really appreciate it!

Lifeng

Quote:
>-----Original Message-----
>MousePosition gives you the mouse coordinates in terms of
the Screen. Use
>PointToClient to convert it to position relative to your
control.



>> I guess I know how to call the method now, but it still
>> behave strangely. The line:
>> Dim oNod As {*filter*}ode = GetNodeAt(MousePosition)
>> Always gives me a node that's 3 positions bellow the one
>> clicked on. How's that?

>> >-----Original Message-----
>> >Use the Click event of the TreeView. To find what node
>> was clicked, if any,
>> >use the MousePosition property and GetNodeAt method.



>> >> Thanks for you reply.
>> >> Neither will work in the follwing scenario:
>> >> A MDI container contains 2 panles, one with a
treeview
>> in
>> >> it, the other displays different forms according to
tree
>> >> nodes you select. When you select a node from the
tree,
>> a
>> >> form will open. Leave the node still selected while
>> close
>> >> the form in the other panle. Now(the node is still
>> >> selected by the form is closed), if you want to open
the
>> >> same form by clicking on the already selected node,
>> guess
>> >> what, it won't work --  you have to click somewhere
else
>> >> and click back again.

>> >> That's the difference between node_click event and
>> >> those "before" or "after"s.

>> >> Any idea?

>> >> Thanks
>> >> >-----Original Message-----
>> >> >Private Sub TreeView1_AfterSelect(ByVal sender As
>> >> System.Object, ByVal e As
>> >> >System.Windows.Forms.TreeViewEventArgs) Handles
>> >> TreeView1.AfterSelect

>> >> >End Sub

>> >> >Private Sub TreeView1_BeforeSelect(ByVal sender As
>> >> Object, ByVal e As
>> >> >System.Windows.Forms.TreeViewCancelEventArgs)
Handles
>> >> TreeView1.BeforeSelect

>> >> >End Sub

>> >> >Before select tells you where you were

>> >> >After select tells you what is currently selected.



>> >> >> I am customizing Windows.Forms.TreeView to add
>> >> >> functionalities. It seems however, that TreeView
>> class
>> >> >> doesn't have a "node clicked" type of event. The
only
>> >> >> thing close to it is the AfterSelect event. But it
>> >> doesn't
>> >> >> realy meet our needs. I find it hard to believe
that
>> >> such
>> >> >> an important event is missing from the control.
But I
>> >> just
>> >> >> can't find it.

>> >> >> Am I missing somthing here?

>> >> >> (By the way I am not inheriting
>> >> AxMSComctlLib.AxTreeView,
>> >> >> although it does have the node_clicked event,
>> because it
>> >> >> gives me strange errors like "ActiveX state
error..."
>> >> when
>> >> >> I use it, and I can't figure out why)

>> >> >> Please help.

>> >> >> Lifeng

>> >> >.

>> >.

>.



Fri, 02 Sep 2005 02:57:06 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. TreeView -Click Event on Plus Sign Node

2. Treeview: highlight node with control Click event

3. Treeview node Click event?

4. TreeView node double-click event?

5. node limit on System.Windows.Forms.Treeview

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

7. Right Click Treeview Doesnt Select Node

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

9. Treeview - detecting click on node icons

10. Right mouse click on Treeview Node

11. Right mouse click on Treeview Node

12. TreeView - Node click cancel

 

 
Powered by phpBB® Forum Software