• 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: NSButton subclass doesn't get performClick:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSButton subclass doesn't get performClick:


  • Subject: Re: NSButton subclass doesn't get performClick:
  • From: Andy Lee <email@hidden>
  • Date: Sun, 5 Feb 2006 11:32:20 -0500

On Feb 5, 2006, at 11:10 AM, Jerry Krinock wrote:

I've subclassed NSButton, and in it I've overridden performClick:, but it
does not get invoked when I click the button...



I see from the docs that -performClick: "[c]an be used to simulate a single mouse click on the receiver." I'm guessing that means it isn't called during an actual mouse click, i.e., it's *only* for simulating such a click in code.


I'm not sure what the solution is, but I would look at the docs for - mouseDown: and possibly consider subclassing NSButtonCell instead of NSButton if necessary.


- (void)mouseDown:(NSEvent *)theEvent

Discussion

Invoked when the mouse button is pressed while the cursor is within the bounds of the receiver, generating theEvent. This method highlights the receiver’s NSCell and sends it a trackMouse:inRect:ofView:untilMouseUp: message. Whenever the NSCell finishes tracking the mouse (for example, because the cursor has left the cell’s bounds), the cell is unhighlighted. If the mouse button is still down and the cursor reenters the bounds, the cell is again highlighted and a new trackMouse:inRect:ofView:untilMouseUp: message is sent. This behavior repeats until the mouse button goes up. If it goes up with the cursor in the control, the state of the control is changed, and the action message is sent to the target. If the mouse button goes up when the cursor is outside the control, no action message is sent.

See Also

– ignoresMultiClick
– trackMouse:inRect:ofView:untilMouseUp: (NSCell)


--Andy

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >NSButton subclass doesn't get performClick: (From: Jerry Krinock <email@hidden>)

  • Prev by Date: first steps
  • Next by Date: Re: first steps
  • Previous by thread: NSButton subclass doesn't get performClick:
  • Next by thread: first steps
  • Index(es):
    • Date
    • Thread