PC Review


Reply
Thread Tools Rate Thread

Context menu - Inserting an Item in a list

 
 
Udi
Guest
Posts: n/a
 
      29th Sep 2005
Hi,
I have a control "A" that displays a list of control "B".
How do I add the ability to insert a new "B" to the list through a
context menu?
I mean, What do I need to do in the event handler code?
Where do I find the location of the mouse when it was
right- clicked, and how do I find the relvant "B" that was clicked?

Thanks!
Udi.

 
Reply With Quote
 
 
 
 
Oliver Sturm
Guest
Posts: n/a
 
      29th Sep 2005
Udi wrote:

>I have a control "A" that displays a list of control "B".
>How do I add the ability to insert a new "B" to the list through a
>context menu?
>I mean, What do I need to do in the event handler code?
>Where do I find the location of the mouse when it was
>right- clicked, and how do I find the relvant "B" that was clicked?


Sorry, I can't tell you like this, because it depends on the control you
use to show the list. Usually, controls that can be used to display a list
of objects, like grids, list boxes and similar controls, have methods that
allow you to find out which entry is shown at a specific position. Or they
might even pass that information in to the mouse click event handler, so
you don't have to query it yourself.

The location of the mouse is the easy part: just use the MousePosition
property or Cursor.Position, alternatively. But note that these methods
give you the mouse position in screen coordinates - you'll probably need
to convert them to control coordinates, using the PointToClient method.


Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add image to Context Menu Strip Menu Item in code Joe Cool Microsoft C# .NET 2 29th Jul 2009 02:16 AM
Add Item to Context Menu Muppidi Microsoft Outlook Form Programming 5 7th Nov 2008 03:15 PM
add item to context menu Muppidi Microsoft Outlook Form Programming 0 5th Nov 2008 12:18 PM
add new item in context menu Muppidi Microsoft Outlook Form Programming 0 5th Nov 2008 12:16 PM
Context menu item John Baro Microsoft C# .NET 0 26th Jul 2003 08:11 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:27 PM.