Click to See Complete Forum and Search --> : TreeView's: Right Click Highlighting


JSawyer
July 22nd, 2005, 12:09 AM
I currently have a tree view in my app. I've noticed that you can right click a node and highlight it, however it's not truely making that node the selected node. I'm a bit dumbfounded on either preventing that or making that node the selected node? Any ideas anyone?

jmcilhinney
July 22nd, 2005, 03:34 AM
That's exactly how the folder tree in Windows Explorer behaves.

hspc
July 22nd, 2005, 03:51 AM
Handle the mouse down click event and Select the node yourself.

JSawyer
July 22nd, 2005, 12:55 PM
If I handle the mouse click, I can't use the BEFORE or AFTER SELECT event for that will only register with the left mouse click. I could do the generic treeview CLICK event but the location for the mouse pointer never seems to match up with where it actually is on the screen.

That will also be very problematic when I have 1000 to 2000 nodes displayed in the tree view. My whole reasoning to handling this, is because a user may right click a node to bring up the context menu to perform an action on that node, however, when the option is choosen, the action is performed on the node that was previously selected with the left mouse button. Not the currently highlighted one via the right mouse button. Any one have any good ideas to approaching this?