7 Replies - 3978 Views - Last Post: 01 May 2012 - 11:42 AMRate Topic:

Choose items in ListView Ctrl using Right-Click .

Posted 28 April 2012 - 03:00 PM

Hello,
I have a listView Ctrl in VB 6.0 Project, i have a PopUpMenu, i want to trigger the PopUpMenu events by choosing items from my ListView Ctrl using Right Click mouse button .
it works but only when i Right Click anywhere on the listview, so i want the Right Click to choose item from ListView and trigger the PopUpMenu to parse events ..... is it doable ?!

Re: Choose items in ListView Ctrl using Right-Click .

Posted 30 April 2012 - 07:28 AM

I believe what you are asking to do is to right click on any line item in the listbox and have the menu differ based on which item you have clicked. I'm not sure that this functionality is available without going to the API. In any case, it isn't standard Windows behavior, either, so you may wish to state what you want to accomplish and ask the best way to do it in terms of UI behavior.

Re: Choose items in ListView Ctrl using Right-Click .

Posted 01 May 2012 - 08:38 AM

Thank you for replying, the thing is that i wanted to left-click on list item and then when i right-click on it it displays popupmenu, but when i left-click on a lit item then i go way from it to another item and then right-click i display the popupmenu although i don't want to show it upon the other item ... so i wanted something to capture the item where the mouse is on and displays relevant popupmenu ... for example :

i have list4 contains 10 items (folders and files) ... i have 2 popupmenus (folder option and file option) ....
not i left-click a (folder) and and then right-click , so it displays the right menu, but when i right-click on a (file) it still displays the (folder option menu) .... !

Re: Choose items in ListView Ctrl using Right-Click .

Posted 01 May 2012 - 10:37 AM

I wouldn't use left click for a popup menu either, since the standard is to use right click. Also, it would be better if you would post the keydown code directly, rather than asking people to download attachments. most of us won't do that for security reasons.

Now, I don't have VB6 up to test this, but I don't think that right clicking changes the selection in a list box. If that's so, then you should be able to base your popup menu on whatever the selected value is in the list box.