Re: Placing Cells in an NSMatrix
Re: Placing Cells in an NSMatrix
- Subject: Re: Placing Cells in an NSMatrix
- From: Peter Teeson <email@hidden>
- Date: Wed, 04 Apr 2012 18:52:53 -0400
On 2012-04-04, at 5:02 PM, Fritz Anderson wrote:
> On 4 Apr 2012, at 2:20 PM, Peter Teeson wrote:
>> Given a 3 x 3 Matrix which is a sub-class of NSMatrix with Cells sub-classed from NSButton
>> the X origins of column 0 cells seem to be 1.0 point inside the Matrix bounds.
>>
>> So if I want to stroke the Matrix bounds with a line width of e.g. 4.0 points
>> it draws over the left area of the column 0 cells.
>>
>> Hence I would like to make sure that the origins of the cells are where I
>> want them to be, i.e. leave enough room to stroke the Matrix bounds.
>>
>> I've read Matrix Programming Guide and looked at the NSMatrix and NSCell
>> references but I do not understand which methods to use to accomplish this.
>>
>> Should I do this in NSCell calcDrawInfo? And then does that mean for each Cell?
>> Surely there must be simple way to provide a frame for all the Cells inset from the bounds of the Matrix.
>>
>> Nor can I find a way to do this in Interface Builder.
>> AutoLayout is checked but Automatically Resizes Cells is not.
>
> I read the NSMatrix class reference to say that NSMatrix enforces its frame being the hull of the cells plus the intercell spacing. You won't accomplish you want, in the way you propose, without fighting the framework.
>
> Why not embed the matrix in a view of your own? You can then draw whatever you like around it.
Thanks for your thought.
But the strange thing is that my experiments show that there is in fact an spacing on the top, right, and bottom
of the area between the cells and the matrix bounds. But not on the left side!!
I would expect there to be equal spacing all around. I have confirmed this by reducing the size of the cells (setCellSize)
and the area between the cells and the Matrix bounds adjusts appropriately except for the left edge.
Something I do not understand is going on here that I do not find logical.
Peter
_______________________________________________
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