• 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: stopTracking in NSButtonCell [solution]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: stopTracking in NSButtonCell [solution]


  • Subject: Re: stopTracking in NSButtonCell [solution]
  • From: "Louis C. Sacha" <email@hidden>
  • Date: Tue, 16 Mar 2004 13:07:58 -0800

Hello...

Sorry, I didn't have a whole lot of time when I wrote that, but what I meant is that you could override trackMouse:inRect:ofView:untilMouseUp: to look something like this:


- (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView:(NSView *)controlView untilMouseUp:(BOOL)untilMouseUp
{
BOOL mouseIsUp = [super trackMouse:theEvent inRect:cellFrame ofView:controlView untilMouseUp:untilMouseUp];

/* you could probably do whatever you had wanted to do in stopTracking:at:inView:mouseIsUp: here */

return mouseIsUp;
}


I haven't actually tested this, this is just based on what the documentation says (which is the other reason I didn't go into much detail before, and sent the message off-list).

Also, if you needed to change when the cell stops tracking the mouse for your particular button cell class (ie to allow tracking just within the cell or anywhere), you could do it by overriding the class method prefersTrackingUntilMouseUp.


Hope that helps,

Louis


Yes, I did, that's where I got "stopTracking:... etc.". Anyways, if anyone is interested, the solution is completely rewriting trackMouse:inRect;ofView:untilMouseup: yourself, since it in fact does not call stopTracking:...

On Mar 15, 2004, at 11:19 PM, Louis C. Sacha wrote:

Hello...

You may want to read the documentation for some of the other NSCell methods for "Tracking the mouse", specifically

- trackMouse:inRect:ofView:untilMouseUp:
+ prefersTrackingUntilMouseUp


Hope that helps,

Louis

Does NSButtonCell not call stopTracking:at:inView:mouseIsUp:? I'm trying to write a button that has a special look when it experiences a roll over (i think there is some sample code for this too if anyone has it, part of adc tips maybe?). ANyways, I have it almost completely working, except when someone holds down, and drags away, in which case mouseExited is NOT called because the control's cell, NSButtonCell, has intercepted all these events. So I said, I'll just subclass the cell class as well to let me know, but apparently it does not respond to stopTracking:at:inView:mouseIsUp:, so is this proper, and secondly, how can I get around this?

Francisco Tolmasky
email@hidden
http://www-scf.usc.edu/~tolmasky/



Francisco Tolmasky
email@hidden
http://www-scf.usc.edu/~tolmasky/

--
Louis C. Sacha
<email@hidden>
or <email@hidden>
_______________________________________________
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: 
 >stopTracking in NSButtonCell (From: Francisco Tolmasky <email@hidden>)

  • Prev by Date: Re: Using bindings with an NSArray of NSStrings ?
  • Next by Date: Re: iTunes plugin/extension project
  • Previous by thread: Re: stopTracking in NSButtonCell
  • Next by thread: Two ABPerson questions (about -copy and -setImageData/-vCardRepresentation)
  • Index(es):
    • Date
    • Thread