473,625 Members | 2,733 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Right Clicking Listbox with select

I'm able to add a context menu to the right click on a listbox but it
does not select the item in the listbox. I would like the context
menu before it pops up to select the item that the mouse was over when
the right click occurred. Is this possible?

Thanks,
Cristov
Nov 15 '05 #1
3 10264
Check out the ListBox's IndexFromPoint function, you can use this to set the
selected item when a right-click occurs.

- Pete
"Chris" <ch*****@hotmai l.com> wrote in message
news:43******** *************** ***@posting.goo gle.com...
I'm able to add a context menu to the right click on a listbox but it
does not select the item in the listbox. I would like the context
menu before it pops up to select the item that the mouse was over when
the right click occurred. Is this possible?

Thanks,
Cristov

Nov 15 '05 #2
"AirPete" <x@x.x> wrote in message news:<Tq******* **********@news read2.news.pas. earthlink.net>. ..
Check out the ListBox's IndexFromPoint function, you can use this to set the
selected item when a right-click occurs.

- Pete
"Chris" <ch*****@hotmai l.com> wrote in message
news:43******** *************** ***@posting.goo gle.com...
I'm able to add a context menu to the right click on a listbox but it
does not select the item in the listbox. I would like the context
menu before it pops up to select the item that the mouse was over when
the right click occurred. Is this possible?

Thanks,
Cristov


Pete,

Thanks for the info. It worked great with my listbox. Now I'm having
the same problem with a listview though and it doesn't support the
IndexFromPoint method. Any ideas?

Thanks,
Cristov
Nov 15 '05 #3

"Chris" <ch*****@hotmai l.com> wrote in message
news:43******** *************** ***@posting.goo gle.com...
"Chris" <ch*****@hotmai l.com> wrote in message
news:43******** *************** ***@posting.goo gle.com...
I'm able to add a context menu to the right click on a listbox but it
does not select the item in the listbox. I would like the context
menu before it pops up to select the item that the mouse was over when
the right click occurred. Is this possible?

Thanks,
Cristov
"AirPete" <x@x.x> wrote in message

news:<Tq******* **********@news read2.news.pas. earthlink.net>. .. Check out the ListBox's IndexFromPoint function, you can use this to set the selected item when a right-click occurs.

- Pete

Pete,

Thanks for the info. It worked great with my listbox. Now I'm having
the same problem with a listview though and it doesn't support the
IndexFromPoint method. Any ideas?

Thanks,
Cristov


Cristov,

I just tried a ListView, and it seemed to seelct on rightclick anyway.
Are you manually showing the ContextMenu on the right Click event, or using
the ContextMenu property?
Mine was set to Activation = Standard and ContextMenu = my contextmenu, with
only an ItemActivate event handler.

However, the GetItemAt method is the ListView's equivilent.

- Pete
Nov 15 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2307
by: f_salazar | last post by:
English Version !! Hi !! I have a page with a Form, inside the form I have listbox with 'X' elements. Wend I submit the page, an ASP process inside the page have to read those elements and then save them in a database. I try Request.Form("listbox") but doesnt work !
3
3605
by: Paul T. Rong | last post by:
I have a listbox (of product names) control on my form. I want to pass the selected item (a product name) to a subform, and the product unitprice should apear automatically next to the product name in the subform. Is it possible? How do I do this? Thanks in advance. Paul from Slovakia
6
30001
by: Dan Bass | last post by:
If you look at explorer, right clicking on a file, first selects the file, then throws up the context menu relating to that selection. With a Windows ListBox control and a simple context menu, the default behaviour seems to display the context menu on the listbox, but there is no selection. Now I know that explorer's using a listview, and that the context menu acts differently if you click on open space (no selection), but can I...
2
2910
by: collie | last post by:
Hi, I have 2 listboxes. The first gets populated from the db as soon as the page loads. The second listbox get populated based on the user's selection from the first listbox. However, currently the code is such that with each selection there is a postback. We want to avoid it using filter and javascript. I am not using ADO.NET but adodbc and no datagrids or datasets (please don't tell me that i should as my boss clearly doesn't want...
4
1850
by: collie | last post by:
HI, I need to populate 2 listboxes from a db. When the page loads then the first listbox needs to be populated and based on selection from that listbox the second listbox needs to be populated accordingly with the matching items. However, my boss doesn't want the page to do a postback once an item from the first listbox is selected. also, he doesn't want to use ado.net but classic ado. He wants to use jscript. I am writing my code in...
1
1670
by: BillyB | last post by:
I have a context menu tied to a list box. When I right-click on an item, I'd like that item to be selected before the context menu invokes, similar to how Outlook Express works when right-clicking on mail items. I've figured out how to trap the right-click in the _MouseDown event, but can't figure out how to set the listbox's selected item to the item under the mouse pointer Thanks Billy
2
1678
by: Niels Jensen | last post by:
Is there a way to select an item ina listbox with the right click event? basically I want a user to be able to rightclick an item which will select the item and then bring up the context menu which has a delete option in it. As it stands if I select an item and then rightclick a seperate item selecting delete will remove the selected item instead of the one that was right clicked Cheers Niels
5
17812
by: mabond | last post by:
Hi My project has a form, two list boxes (lstArchive and lstSchedule) and two buttons (btnSendArchive and btnSendSchedule) Each list box represents the content of a directory. The command buttons move the selected item out of one directory and into the other and refreshes the list boxes to reflect the change in directory contents I now want to add "context menu" functionality to the list boxes to preform
1
1428
by: Filips Benoit | last post by:
Dear All, Form having on the leftside 50 fields (text) to be inputted with about 20 different values from a listbox on the rightside of the form. I want to do the input by clicking no keyboard-inputs. I click (select) a fields and then a value in the listbox. Clicking the value in the listbox = setting the value of the selected field. How
0
8189
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8692
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8354
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7182
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6116
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4089
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2621
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1499
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.