Re: Getting the context of a context menu
Re: Getting the context of a context menu
- Subject: Re: Getting the context of a context menu
- From: Nicko van Someren <email@hidden>
- Date: Fri, 13 Apr 2007 12:44:27 +0100
On 13 Apr 2007, at 00:09, Johan Kool wrote:
Shouldn't this be done as follows?
- set the menuitem's target to the first responder
- implement the action method somewhere in the responder chain, in
this case the view that uses the contextual menu
Unfortunately that fails for two reasons. Firstly, my reason for
trying to find out the context in which a menu was raised, after it
was raised, was to be able to avoid having to sub-class every single
type of UI object that I might want to click on. The specific case
is for the 'default' context menu which I use for 'everything else'
that I've not built myself, so I'd ideally prefer not to have to sub-
class everything else.
The second reason is even more compelling, since it's not simple a
matter of personal preference; this solution doesn't work!
Specifically, the item on which you ctrl-click to raise a context
menu does not need to be in the responder chain. Since a right-click
does not move the input focus it's perfectly possible for the user
to, say, ctrl-click on button while the focus is in some text field,
and the responder chain doesn't go near the button on which the user
clicked.
Cheers,
Nicko
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden