By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,028 Members | 1,314 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,028 IT Pros & Developers. It's quick & easy.

Get object that called context menu

P: n/a
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
Share this Question
Share on Google+
4 Replies


P: n/a
"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

P: n/a
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

P: n/a
> 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

P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.