• 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: "Frank D. Engel, Jr." <email@hidden>
  • Date: Thu, 04 Jun 2015 19:19:39 -0400


On 6/4/2015 18:43, Graham Cox wrote:
On 5 Jun 2015, at 6:38 am, Frank D. Engel, Jr. <email@hidden> wrote:


On 6/3/2015 20:29, Graham Cox wrote:
On 4 Jun 2015, at 10:20 am, Frank D. Engel, Jr. <email@hidden> wrote:

I am wondering if the browser is actually caching an image of the cells in the second column when I switch away, then just displaying that without actually recreating the cells in the second column until it needs one of them for something?  That might explain the behavior I am seeing, and may be a sensible optimization in most cases, but in this instance it is not very helpful for my particular application.
Sounds very doubtful.

[self controlView] is probably unreliable in your cell - you might want to check it. But even if it’s correct (being the NSMatrix for the browser column) invalidating the whole thing is going to be very sub-performant (though should work).

Note that NSBrowser, unlike a NSTableView, allocates one cell per row within a NSMatrix - it does not reuse and redisplay a single cell.

—Graham



My method isn't even being called at that point, so it never gets that far.

Which method? Unfortunately the problem isn’t very clearly stated, so I don’t know if it’s the view refresh that you're having trouble with (as I supposed) or some other meaning of “refresh” that you’re applying.

—Graham



- (void)browser:(NSBrowser *)browser willDisplayCell:(MyBrowserCell *)cell atRow:(NSInteger)row column:(NSInteger)column
{
    // Find the item and set the image.
    WhateverObject *c = [browser itemAtRow:row inColumn:column];
*[cell bind:@"image" toObject:c withKeyPath:@"icon" options:nil];*
}


- (void)setIcon:(NSImage *)icon
{
// this is for the benefit of bindings - it doesn't actually do anything itself // it tricks the bindings mechanism into updating the icons in the browser, etc.
    NSLog(@"setIcon called");
}


- (void)setImage:(NSImage *)newImage
{
    NSLog(@"setImage called");
    img = newImage;
    [[self controlView] setNeedsDisplay:YES];
}


When I switch to a different row in the first row, then switch back, even though the "icon" property is changing (my "setIcon called" text appears), the "setImage called" text never appears, meaning that my setImage method is not being called.
Once I select a row within the second column, it starts being called again.

I did notice that "setImage" is actually being called temporarily if I switch to another window, or switch back - but it only does so momentarily then it stops again.


_______________________________________________

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

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