Skip navigation.
 
mlRe: NSBrowser drawInteriorWithFrame called before willDisplayCell, causing display problems
FROM : Bryan Hansen
DATE : Thu Nov 29 20:24:45 2007

Corbin and Ben,

Thanks for the support here. The code Corbin provided has fixed our 
problem! Thanks so much for the help.

Bryan

On Nov 27, 2007, at 4:40 PM, Corbin Dunn wrote:

>
> On Nov 27, 2007, at 2:26 PM, Benjamin Stiglitz wrote:
>

>>> I am experiencing some strange drawing issues with an NSBrowser 
>>> that uses a subclass of NSBrowserCells with the NSBrowserCell 
>>> also having a representedObject set. I'm not sure exactly what is 
>>> causing the problem, but the issue seems to stem from the fact 
>>> that [NSBrowserCell drawInteriorWithFrame:inView:] ends up 
>>> causing [CKDirectoryTreeController 
>>> browser:willDisplayCell:atRow:column:]  (the NSBrowser delegate 
>>> method) to get called after. Since this delegate method is where 
>>> the representedObject is set, when the 
>>> drawInteriorWithFrame:inView method gets called first it does not 
>>> yet have the correct data to draw correctly. I have compared the 
>>> order of the method calls to the SimpleBrowser example and the 
>>> browser:willDisplayCell:atRow:column is always called before the 
>>> drawInteriorWithFrame:inView method, so the problem is not 
>>> evident. Also, any drawing that occurs after these two methods 
>>> are called in the "wrong" order is drawn correctly as the node is 
>>> set going forward.

>>
>> Bryan, what appearance are you trying to achieve? Getting this 
>> subclassing right on Tiger involves overriding some private 
>> methods, so it’d be best to make sure that it’s really necessary 
>> before you take that route.

>
> Ben and I talked about this; unfortunately, you are running into a 
> bug in NSBrowser which has been fixed on Leopard. To work around 
> it, do something like this:
>
> if (![self isLoaded]) {
>    [[browser delegate] browser:browser willDisplayCell:cell 
> atRow:column:]; // row/col can be acquired through the public 
> browser API.
>    [self setLoaded:YES];
> ... do your drawing.
>
> corbin

Related mailsAuthorDate
mlNSBrowser drawInteriorWithFrame called before willDisplayCell, causing display problems Bryan Hansen Nov 27, 01:47
mlRe: NSBrowser drawInteriorWithFrame called before willDisplayCell, causing display problems Benjamin Stiglitz Nov 27, 23:26
mlRe: NSBrowser drawInteriorWithFrame called before willDisplayCell, causing display problems Corbin Dunn Nov 28, 01:40
mlRe: NSBrowser drawInteriorWithFrame called before willDisplayCell, causing display problems Bryan Hansen Nov 29, 20:24