Re: Right (or cntl)-clicking a button
Re: Right (or cntl)-clicking a button
- Subject: Re: Right (or cntl)-clicking a button
- From: Sherm Pendley <email@hidden>
- Date: Sat, 19 Apr 2003 09:16:42 -0400
On Saturday, April 19, 2003, at 07:20 AM, Bill Cheeseman wrote:
on 03-04-18 10:40 PM, Sherm Pendley at email@hidden wrote:
Here's some example code. All the usual caveats apply - typed in email,
untested, etc.:
- (IBACTION) buttonClicked: (NSButton) sender {
if ([[[sender window] currentEvent] modifierFlags] &&
NSControlKeyMask) {
// Handle control-click
} else {
// Handle ordinary click
}
}
Shouldn't that be a bitwise and (&, not &&)?
Yes, it should. Mail.app should have a compiler in it... :-(
And why not just [NSApp currentEvent], instead of [[sender window]
currentEvent] -- in other words, is there any reason why it matters
which
you use?
I found it first in NSWindow, so that's what I tend to use, just out of
habit. I don't think it makes a difference.
sherm--
C programmers never die - they're just cast into void.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.