473,413 Members | 1,801 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,413 software developers and data experts.

Get object that called context menu

Hello,

I have a single ConextMenu that is used for dozens of labels. When the user
right-clicks the label, they select a menu item, and that label's text and
tag should be added to a ListBox.

How can I reference the label that initially called the context menu to
popup? I know that I could get the X, Y coordinates of the click, but is
there a more precise way to do this?

Thank you,

Eric

Nov 21 '05 #1
4 1612
"Eric" <anon> wrote in news:es*************@tk2msftngp13.phx.gbl:
Hello,

I have a single ConextMenu that is used for dozens of labels. When
the user right-clicks the label, they select a menu item, and that
label's text and tag should be added to a ListBox.

How can I reference the label that initially called the context menu
to popup? I know that I could get the X, Y coordinates of the click,
but is there a more precise way to do this?

Thank you,

Eric


I could be completely off-track, since I am a bit of a novice...

But couldn't you use the *sender* argument to grab the label's identity on
a mouseup/down event? Or is that not how you access your ContextMenu?
Nov 21 '05 #2
ContextMenu.SourceControl

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Eric" <anon> wrote in message news:es*************@tk2msftngp13.phx.gbl...
Hello,

I have a single ConextMenu that is used for dozens of labels. When the
user
right-clicks the label, they select a menu item, and that label's text and
tag should be added to a ListBox.

How can I reference the label that initially called the context menu to
popup? I know that I could get the X, Y coordinates of the click, but is
there a more precise way to do this?

Thank you,

Eric

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004
Nov 21 '05 #3
> I could be completely off-track, since I am a bit of a novice...

But couldn't you use the *sender* argument to grab the label's identity on
a mouseup/down event? Or is that not how you access your ContextMenu?


Thank you for the reply, Confessor. The sender argument is of type
MenuItem. Mick's answer (ContextMenu.SourceControl) is correct.

Eric
Nov 21 '05 #4
Thank you, Mick. Just what I was looking for. (I don't know how I missed
that on MSDN!)

Eric

"Mick Doherty"
<EX***********@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> wrote in
message news:OY*************@tk2msftngp13.phx.gbl...
ContextMenu.SourceControl

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Eric" <anon> wrote in message
news:es*************@tk2msftngp13.phx.gbl...
Hello,

I have a single ConextMenu that is used for dozens of labels. When the
user
right-clicks the label, they select a menu item, and that label's text
and
tag should be added to a ListBox.

How can I reference the label that initially called the context menu to
popup? I know that I could get the X, Y coordinates of the click, but is
there a more precise way to do this?

Thank you,

Eric

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.742 / Virus Database: 495 - Release Date: 19/08/2004

Nov 21 '05 #5

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

Similar topics

8
by: Steve Neill | last post by:
Can anyone suggest how to create an arbitrary object at runtime WITHOUT using the deprecated eval() function. The eval() method works ok (see below), but is not ideal. function Client() { }...
1
by: scott | last post by:
Hi all, im not sure if this is possible but would be a grate help if it was. I have a several buttons and all have a context menu. That context menu has one menu item called delete. All...
4
by: Luke Matuszewski | last post by:
Here are some questions that i am interested about and wanted to here an explanation/discussion: 1. (general) Is the objectness in JavaScript was supported from the very first version of it (in...
16
by: Roman Ziak | last post by:
Hello, there were times when I used to be looking for a way to access JavaScript Global object similar to those found in VBScript or PHP ($GLOBALS). At present this has only academic value for...
5
by: wxnut | last post by:
In VB 2005 I have six seperately named picture boxes (arranged in a table layout control) in which I plot different X/Y data lines. I would like to be able to right-click on a specific picture box...
3
by: User1014 | last post by:
A global variable is really just a property of the "Global Object", so what does that make a function defined in the global context? A method of the Global Object? ...
1
by: Louis-Pierre Dauphinais | last post by:
To get the control that called a context menu item (ToolStripMenuItem), I normally do: itm.Owner.SoucreControl but what if the menu item is actually in a second level of the context menu? I...
2
by: Bry | last post by:
I have a context menu which is shared between a TreeView and ListView control (both controls show the same information, similar to how Windows Explorer works, so it makes sense to use the same menu...
0
by: Patel | last post by:
Hi All, I am doing one INTERESTING work with Context Menu Strip. I am trying to insert a custom control / .Net control in Context menu as a context menu strip. I tried inserting MonthCalender in...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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...
0
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...
0
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...

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.