• 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: Questions about NSPopupButtonCell and NSBrowser
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Questions about NSPopupButtonCell and NSBrowser


  • Subject: Re: Questions about NSPopupButtonCell and NSBrowser
  • From: Graham Cox <email@hidden>
  • Date: Thu, 04 Jun 2015 09:39:50 +1000

> On 4 Jun 2015, at 7:29 am, Frank D. Engel, Jr. <email@hidden> wrote:
>
> Now what I am hoping is the simpler one:
>
> I have a custom subclass of NSTextFieldCell which I am using to show an icon in an NSBrowser.  The icon image is being generated dynamically by a method in my subclass and I want it to change more or less in "real time" as a bound value changes.  I have that almost working, but the one problem is that it doesn't refresh when I need it to.
>
> Is there some way I can "force" a browser cell to redraw its image, short of redrawing the entire browser or window?  The text isn't changing, just the icon, but I'd settle for redrawing the cell...
>
> I've tried a number of things to get this working and it seems I keep coming up short.


NSBrowser normally uses NSBrowserCell to draw its content. That class has a -setImage: method which presumably knows how to mark the correct part of its host view as needing display.

If you have to use a different cell class, then you’ll need to figure out how to do the same. The cell is part of a 1-column NSMatrix which has methods to return the rect occupied by a given row, so given that you can call -setNeedsDisplayInRect: on the matrix itself. Useful methods there are -[NSMatrix getRow:column:ofCell:] and -[NSMatrix cellFrameAtRow:column:];


hth,

—Graham




_______________________________________________

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: Questions about NSPopupButtonCell and NSBrowser
      • From: "Frank D. Engel, Jr." <email@hidden>
References: 
 >Questions about NSPopupButtonCell and NSBrowser (From: "Frank D. Engel, Jr." <email@hidden>)

  • Prev by Date: Questions about NSPopupButtonCell and NSBrowser
  • Next by Date: Re: Questions about NSPopupButtonCell and NSBrowser
  • Previous by thread: Questions about NSPopupButtonCell and NSBrowser
  • Next by thread: Re: Questions about NSPopupButtonCell and NSBrowser
  • Index(es):
    • Date
    • Thread