Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Treeview - Right click (select?) 1

Status
Not open for further replies.

klibby

Programmer
May 30, 2001
51
US
... probably a simple question with a simple solution but.. ummm...

How would you make it so when you right click a node on a treeview list, it would select the item you right clicked on, and bring up a menu for that selected node? (i know how to bring up the menu.. just not how to select the item that was right clicked)....

What im doing, is making a buddy list for an instant messenger program im working on for an ISP... I have it so when you double click the node, it brings up the send message box for that user... and I want it so when you right click the node, it will bring up a little popup menu for the selected user..... but in order to do that, I need to have the user selected when you right click (like the buddy list on AIM.. it selects it for you when you right click)...

I know I COULD have the user left click to select it THEN ight click.. but I'm trying to make it more user friendly than that hehe


Any ideas would be greatly appreciated =)
 
I suppose you worked with the mousedown event.

After confirming that the right button was clicked you type

trTreeview1.SelectedItem = trProfiles.HitTest(X, y)

make sure you do a

If trTreeview1.SelectedItem Is Nothing Then Exit Sub
'or something

coz the idiot, i mean user, might right click on a space

Rock On!!!
 
Ahhh schweet, never really knew what HitTest was hehe
But thanks a ton man, that helps a lot =)

.. and lol.. "..the idiot, i mean user.." yup! lol always gotta make em "idiot.. err.. user friendly" though.. not a good thing to call your user an idiot.. with them knowing =P

anyway, thanks a ton man =)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top