matrixes, custom cells, prototypes, and drawing
matrixes, custom cells, prototypes, and drawing
- Subject: matrixes, custom cells, prototypes, and drawing
- From: Matt Neuburg <email@hidden>
- Date: Tue, 31 Jan 2006 12:00:51 -0800
- Thread-topic: matrixes, custom cells, prototypes, and drawing
>> I have an NSMatrix (actually, it's a subclass, MyMatrix) whose cell is a
>> custom NSCell type, i.e. MyCell. I couldn't find a way in Interface Builder
>> to specify that the whole matrix should use MyCell, so in Interface Builder I
>> made the NSMatrix be one cell, an NSButtonCell, and then I used Custom Class
>> to set that one cell to MyCell (which is an NSButtonCell subclass for this
>> sole reason). Then, in my app, in the matrix's awakeFromNib, I set the
>> matrix's prototype and add a row with addRow. So now we've got two rows and
>> they are both displaying MyCell.
>>
>> The weird thing is that the two rows behave very differently when they
>> redraw. The second row, the one added in code, gets redraw messages far more
>> often than the first row; and when it does, it redraws over the old drawing,
>> so that as time goes on it gets darker and darker and fuzzier and fuzzier.
>> Meanwhile, the first row, the one specified in IB, redraws just fine.
>>
>> I can think of ways to work around this, but my question is: why? What's
>> causing this difference in redraw behavior? Thx. m.
>>
> Further to this: Using Quartz Debug I can see also that there is a big
> difference between the way the original cell redraws and the way the new cell
> redraws. The original cell flashes a complete rectangle when it redraws, but
> the added cell just flashes in the areas of the cell where my
> drawInteriorWithFrame explicitly draws. Again, the question is: how can it be
> that two cells with the same class are behaving so differently? Thx m.
Solved it, thanks to Eric Morand's note:
<http://www.cocoabuilder.com/archive/message/cocoa/2005/9/8/145918>
I still don't understand why the IB-created cell and the code-created cell
would behave differently, though. m.
--
matt neuburg, phd = email@hidden, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
AppleScript: the Definitive Guide -
http://www.amazon.com/exec/obidos/ASIN/0596005571/somethingsbymatt
Take Control of Word 2004, Tiger, and more -
http://www.takecontrolbooks.com/tiger-customizing.html
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden