Re: Accessing [event modifierFlags] in an action method?
Re: Accessing [event modifierFlags] in an action method?
- Subject: Re: Accessing [event modifierFlags] in an action method?
- From: Graham Cox <email@hidden>
- Date: Tue, 20 May 2008 22:21:06 +1000
[[NSApp currentEvent] modifierFlags];
hth,
G.
On 20 May 2008, at 10:16 pm, Matt Gough wrote:
I have an action method for a disclosure button :
-(IBAction) toggleText:(id) sender
{
[self doSomethingUseful];
}
I now want it to behave slightly differently if the command key was
down when the button was clicked, but can see no 'simple' way to get
the state of the modifier keys from with the action method.
OK I do know a way, I could call GetCurrentKeyModifiers() or
GetCurrentEventKeyModifiers() in toggleText, but I was really
looking for a way to get the NSEvent that was used to trigger the
action.
I could probably also subclass NSButton and keep hold of the event
or modifierFlags inside mouseDown and pick up on them inside of
toggleText.
This seems such a common thing to want to do that I am sure there is
a simple and correct way to do it. However that path currently
eludes me.
Thanks
Matt
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please 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