> On 4 Jun 2015, at 7:29 am, Frank D. Engel, Jr. <fde...@fjrhome.net> 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 (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to