• 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: NSButtonCell doesn't visually update during trackMouse:inRect:ofView:untilMouseUp:
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSButtonCell doesn't visually update during trackMouse:inRect:ofView:untilMouseUp:


  • Subject: Re: NSButtonCell doesn't visually update during trackMouse:inRect:ofView:untilMouseUp:
  • From: "Ken Ferry" <email@hidden>
  • Date: Mon, 17 Mar 2008 13:25:26 -0700

On Mon, Mar 17, 2008 at 8:49 AM, glenn andreas <email@hidden> wrote:
>
>  On Mar 17, 2008, at 1:42 AM, Ben Lachman wrote:
>
>  > I have a few NSButtonCells that I'm using in a custom view.  I need
>  > them to track the mouse during clicks and do this by calling
>  > NSCell's trackMouse:inRect:ofView:untilMouseUp:.  This works fine
>  > except that the button cells never update their graphical state by
>  > highlighting or whatever.  However if I call performClick: on them
>  > the button updates as it should.  Is the only solution to this to
>  > implement mouse tracking at the view instead of at the cell level?
>
>
>  You need to set the control view of the cell to your view and then
>  implement the appropriate [update|draw]cell[inside]: methods in your
>  view.

Or, a bit more specifically, setControlView: will fail to store
anything if the passed view is not an NSControl.  You can use an
NSCell to purely stamp out drawing in an NSView, but more complicated
interaction requires the view to be an NSControl, so that the cell can
message the control in various ways.  It isn't just updateCell:.

Ken Ferry
Cocoa Frameworks

>  Basically a cell expects to be inside a control and needs to be
>  able to tell that control to draw itself (and thus redraw the cell).
>  One would think that the parameters to trackMouse would be sufficient
>  to have the cell handle this by itself, but since a control could have
>  a background behind the cell, it's really up to the control to decide
>  how to redraw the cell.
>
>
>  Glenn Andreas                      email@hidden
>   <http://www.gandreas.com/> wicked fun!
>  quadrium | prime : build, mutate, evolve, animate : the next
>  generation of fractal art
>
>
>
>
>
>  _______________________________________________
>
>  Cocoa-dev mailing list (email@hidden)
>
>  Please do not post admin requests or moderator comments to the list.
>  Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
>  Help/Unsubscribe/Update your Subscription:
>
>  This email sent to email@hidden
>
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: NSButtonCell doesn't visually update during trackMouse:inRect:ofView:untilMouseUp:
      • From: Ben Lachman <email@hidden>
References: 
 >NSButtonCell doesn't visually update during trackMouse:inRect:ofView:untilMouseUp: (From: Ben Lachman <email@hidden>)
 >Re: NSButtonCell doesn't visually update during trackMouse:inRect:ofView:untilMouseUp: (From: glenn andreas <email@hidden>)

  • Prev by Date: Equivalent to Carbon's TransitionWindow(); using genie when opening an NSWindow
  • Next by Date: Re: Return the value to a pop up window
  • Previous by thread: Re: NSButtonCell doesn't visually update during trackMouse:inRect:ofView:untilMouseUp:
  • Next by thread: Re: NSButtonCell doesn't visually update during trackMouse:inRect:ofView:untilMouseUp:
  • Index(es):
    • Date
    • Thread