• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Right (or cntl)-clicking a button
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Right (or cntl)-clicking a button


  • Subject: Re: Right (or cntl)-clicking a button
  • From: Greg Hurrell <email@hidden>
  • Date: Mon, 28 Apr 2003 21:39:56 +0930

Can someone confirm for me whether NSButton objects actually receive NSRightMouseDown events?

I notice that if I right-click on just about any NSButton in any app, none of them appear to be receiving the click.

In my own app I have an NSButton subclass and I've put an NSLog() in the rightMouseDown: method but the log statement almost* never produces anything... It's as though the button isn't receiving the event.

(*) it gets the right-click if it happens to be first responder (or so it appears)... it's something about the responder chain I guess... For me this is fairly useless if buttons will only "see" right-clicks if they also happen to be first responder!

Anyone can shed any light on this?

Regards,
Greg

El Saturday, 19 Apr, 2003, a las 22:46 Australia/Adelaide, Sherm Pendley escribis:

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.
_______________________________________________
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.

References: 
 >Re: Right (or cntl)-clicking a button (From: Sherm Pendley <email@hidden>)

  • Prev by Date: Re: Protocols on the fly?
  • Next by Date: Re: File Detection
  • Previous by thread: Re: Right (or cntl)-clicking a button
  • Next by thread: Implanting combo box in table view
  • Index(es):
    • Date
    • Thread