• 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: NSActionCell mouseEntered crashes application
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSActionCell mouseEntered crashes application


  • Subject: Re: NSActionCell mouseEntered crashes application
  • From: glenn andreas <email@hidden>
  • Date: Thu, 27 Apr 2006 13:47:21 -0500


On Apr 27, 2006, at 11:53 AM, Marc Monguio wrote:

I've subclassed NSActionCell so that I can mouseover on the area defined by an NSRect but then the application crashes. The code looks like following:

@implementation MyCell
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *) controlView;
{
NSRect userBounds = cellFrame //I'm using the cellFrame to simplify the example
NSTrackingRectTag trackingTag = [[self controlView] addTrackingRect:userBounds owner:self userData:nil assumeInside:NO];
// (...)
}

For one thing, you shouldn't be adding tracking rects inside of the draw routine - especially since that routine can get called multiple times (which results in multiple tracking rects). Not to mention that cells are created/disposed of in various ways (sometimes cloned before drawing, and disposed of afterwards).


I'd go on to say that at the cell level is probably the wrong place to add this - cells aren't best place for this sort thing (because they have no fixed coordinate space of their own, and can be used multiple times in multiple locations, like in an NSTableView, so even if you establish a cursor rect, the view may actually be somewhere else when the mouse moves over it, and the cell can realistically redraw itself anyway, so you can't update the view to handle mouseover that causes a change in the appearance of the cell), but rather in the view hosting the cell (such as your NSButton view).




Glenn Andreas email@hidden <http://www.gandreas.com/> wicked fun! quadrium | build, mutate, evolve | images, textures, backgrounds, art

_______________________________________________
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: 
 >NSActionCell mouseEntered crashes application (From: Marc Monguio <email@hidden>)

  • Prev by Date: Re: Selector of Open recent document
  • Next by Date: OT: socket question
  • Previous by thread: Re: NSActionCell mouseEntered crashes application
  • Next by thread: NSTableView app design
  • Index(es):
    • Date
    • Thread