That was not really a complete answer to the question. What this person
needs to do is:
- get info on the node (as described in the above using HitTest(x,y))
- then call Select on that node:
my $node = $treeview->HitTest($mouse_x,$mouse_y);
$treeview->Select($node);
# Now the right node is selected before you show the menu.
# do stuff to show the contextmenu ...
Assuming he wants it selected; I would rather not cause right-click to
select a node (leave that to left-click), but if I wanted right-click to
give info on the node under it as opposed to the selected node, I would pass
the node info directly on to the sub that's changing the context menu
(unless, of course, that's actually tied to the selected node and you don't
want to change that code).
I would rather not have right-click do anything except the context menu; in
an edit control, for example, I don't want right-click moving the cursor
position, and in a treeview, I don't want it changing the selected node. Of
course, that's just personal preference.
_________________________________________________________________
STOP MORE SPAM with the new MSN 8 and get 2 months FREE*
http://join.msn.com/?page=features/junkmail