Re: NSBrowser drawInteriorWithFrame called before willDisplayCell, causing display problems
Re: NSBrowser drawInteriorWithFrame called before willDisplayCell, causing display problems
- Subject: Re: NSBrowser drawInteriorWithFrame called before willDisplayCell, causing display problems
- From: Corbin Dunn <email@hidden>
- Date: Tue, 27 Nov 2007 16:40:34 -0800
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_______________________________________________
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