473,387 Members | 1,574 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 10251
Check out the ListBox's IndexFromPoint function, you can use this to set the
selected item when a right-click occurs.

- Pete
"Chris" <ch*****@hotmail.com> wrote in message
news:43**************************@posting.google.c om...
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*****************@newsread2.news.pas.earth link.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*****@hotmail.com> wrote in message
news:43**************************@posting.google.c om...
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*****@hotmail.com> wrote in message
news:43**************************@posting.google.c om...
"Chris" <ch*****@hotmail.com> wrote in message
news:43**************************@posting.google.c om...
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*****************@newsread2.news.pas.earth link.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
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...
3
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...
6
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,...
2
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,...
4
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...
1
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...
2
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...
5
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...
1
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...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.