470,641 Members | 2,653 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,641 developers. It's quick & easy.

Treeview Node Click

Hi All

I've got a treeview with checkboxes. I want the user to be able to
toggle the checkbox by click on the checkbox OR by clicking on the
node text.

So I've added an afterselect event handler to get the selected node
and change the .Checked property of the selected node as appropriate,
which works to change the .Checked status when the user FIRST clicks
on the text of a particular node.

But if they user then clicks on the text of the same node, the
afterselect event DOES NOT fire, because it was already selected I
guess. Can anyone tell me what other event I need to interpret that
click on the same node and then how to call the fire the afterselect
event handler from the click event handler?

Thanks.
Aug 28 '08 #1
2 4241
On Aug 28, 7:36*am, govolsb...@gmail.com wrote:
Hi All

I've got a treeview with checkboxes. *I want the user to be able to
toggle the checkbox by click on the checkbox OR by clicking on the
node text.

So I've added an afterselect event handler to get the selected node
and change the .Checked property of the selected node as appropriate,
which works to change the .Checked status when the user FIRST clicks
on the text of a particular node.

But if they user then clicks on the text of the same node, the
afterselect event DOES NOT fire, because it was already selected I
guess. *Can anyone tell me what other event I need to interpret that
click on the same node and then how to call the fire the afterselect
event handler from the click event handler?

Thanks.
Oh yeah, using afterselect doesn't really work because then it wants
to change the textbox if I get to the node by using the arrow keys to
navigate through the treeview. I only want it to change the checkbox
if I actually click on the node text.

I did try create a .NodeMouseClick event handler, but it seems to
think the selected node is the one I just came from rather than the
one I clicked on.

Thanks.
Aug 28 '08 #2
On Aug 28, 7:46*am, govolsb...@gmail.com wrote:
On Aug 28, 7:36*am, govolsb...@gmail.com wrote:
Hi All
I've got a treeview with checkboxes. *I want the user to be able to
toggle the checkbox by click on the checkbox OR by clicking on the
node text.
So I've added an afterselect event handler to get the selected node
and change the .Checked property of the selected node as appropriate,
which works to change the .Checked status when the user FIRST clicks
on the text of a particular node.
But if they user then clicks on the text of the same node, the
afterselect event DOES NOT fire, because it was already selected I
guess. *Can anyone tell me what other event I need to interpret that
click on the same node and then how to call the fire the afterselect
event handler from the click event handler?
Thanks.

Oh yeah, using afterselect doesn't really work because then it wants
to change the textbox if I get to the node by using the arrow keys to
navigate through the treeview. *I only want it to change the checkbox
if I actually click on the node text.

I did try create a .NodeMouseClick event handler, but it seems to
think the selected node is the one I just came from rather than the
one I clicked on.

Thanks.
LOL I love these kinds of posts. I first post my problem. Then I
find the solution on my own. Below, myNode ends up being the node
that the user clicked on. Before I was trying to interpret
the .SelectedNode property of sender (a treeview object).

Private Sub tvMEL_MouseClick(ByVal sender As Object, ByVal e As
System.Windows.Forms.TreeNodeMouseClickEventArgs) Handles
tvMEL.NodeMouseClick
Dim myNode As MELTreeNode = e.Node
End Sub
Aug 28 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by .pd. | last post: by
1 post views Thread by Aleksey | last post: by
6 posts views Thread by Tim | last post: by
2 posts views Thread by Srinivasa Raghavan | last post: by
5 posts views Thread by A-PK | last post: by
14 posts views Thread by Mr.D | last post: by
3 posts views Thread by Shawn | last post: by
18 posts views Thread by =?Utf-8?B?TGkgV2VuZw==?= | last post: by
1 post views Thread by Korara | last post: by
???
1 post views Thread by Stoney L | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.