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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to