Connecting Tech Pros Worldwide Help | Site Map

Treeview Node Click

 
LinkBack Thread Tools Search this Thread
  #1  
Old August 28th, 2008, 12:45 PM
govolsbaby@gmail.com
Guest
 
Posts: n/a
Default 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.

  #2  
Old August 28th, 2008, 12:55 PM
govolsbaby@gmail.com
Guest
 
Posts: n/a
Default Re: Treeview Node Click

On Aug 28, 7:36*am, govolsb...@gmail.com wrote:
Quote:
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.
  #3  
Old August 28th, 2008, 12:55 PM
govolsbaby@gmail.com
Guest
 
Posts: n/a
Default Re: Treeview Node Click

On Aug 28, 7:46*am, govolsb...@gmail.com wrote:
Quote:
On Aug 28, 7:36*am, govolsb...@gmail.com wrote:
>
>
>
Quote:
Hi All
>
Quote:
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.
>
Quote:
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.
>
Quote:
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?
>
Quote:
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
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,989 network members.