Re: Setting origins for NSMatrix cells
Re: Setting origins for NSMatrix cells
- Subject: Re: Setting origins for NSMatrix cells
- From: "John C. Randolph" <email@hidden>
- Date: Fri, 7 Apr 2006 20:59:18 -0700
On Apr 7, 2006, at 8:06 PM, P Teeson wrote:
Using Mac OS X 10.4.5, XCode 2.2.1.
In my app I have an NSMatrix subclass with overridden methods
initWithFrame and drawRect.
The cell class is a subclass of NSButtonCell
It's overridden method is drawWithFrame (working with flipped co-
ordinates although I never set
that in any graphics context).
There are 9 cells in a 3 by 3 array in the matrix view.
My problem is that the cellFrames passed in to this method have
origins that are not what I want.
For example the first cell is at 0,0 when I really want it to be
inset from the controlView frame by
a few pixels - e.g. at 4,4.
Now of course I can write code to adjust the cellFrame rects to
meet my needs.
But this seems excessive to me when some method somewhere is
already computing the cellFrame.
My guess is that this is happening somewhere in NSMatrix or it's
ancestors but so far
I have not been able to track it down.
Any suggestions would be gratefully received.
Subclass NSMatrix, and override -cellFrameAtRow:colum: to return
whatever rect you want. You probably also want to override -
getRow:column:forPoint:
-jcr
John C. Randolph <email@hidden> (408) 914-0013
Roaming Cocoa Engineer,
Available for your projects at great Expense and Inconvenience.
_______________________________________________
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