Re: Re-wrapping cells in an NSMatrix with bindings
Re: Re-wrapping cells in an NSMatrix with bindings
- Subject: Re: Re-wrapping cells in an NSMatrix with bindings
- From: "Lawrence Sanbourne" <email@hidden>
- Date: Fri, 28 Apr 2006 09:26:13 -0500
On 4/28/06, John Buckley <email@hidden> wrote:
Lawrence,
I have a similar custom NSMatrix, used to implement an "icon view".
There is a 'private' method on NSMatrix called "-
_selectFirstEnabledCell" which gets called at various times by
NSMatrix and does what it says on the tin. This may be interfering
with the behaviour you want - i.e. re-flow columns but maintain the
current selection.
I re-implemented _selectFirstEnabledCell in my subclass as an empty
method - it does nothing. This fixed all my weird selection problems.
Wow, I would never have thought of this. I implemented the method in
my subclass as an empty method, and now the selection problem is gone.
However, the matrix actually never updates its selection from the
array controller at all now.
In fact, I think overriding the private method actually uncovered my
problem -- the NSMatrix isn't updating its selected objects when the
array controller's selectedObjects changes. The reverse direction of
communication -- array controller updating when matrix changes -- is
working, although I should note that I wrote the behavior myself in
-mouseDown (irrelevant because it also worked before I re-implemented
the selection behavior).
Did any of this make sense? Any ideas on getting the matrix to update
its selection based on the selectedObjects binding, or do I need to
implement that functionality manually?
Larry
On 27/04/06, Lawrence Sanbourne <email@hidden> wrote:
> Hello,
>
> I'm developing an application with UI similar to iPhoto. I'm using an
> NSMatrix subclass to display the photos (in this case, icons). The
> matrix is bound to an array controller's arrangedObjects. When the
> window is resized (or the view otherwise changes size), the matrix
> needs to gain or lose columns, scaling accordingly, and then rewrap
> the displayed objects.
>
> I've gotten it to gain and lose columns and scale properly. The
> problem is that I'm currently doing the rewrapping by calling
> -rearrangeObjects on the array controller, which is causing the
> matrix's enclosing scroll view to scroll to the top and the selection
> to be restored to the first object.
>
> What would be a better way of doing this that would still play nicely
> with bindings?
>
> Larry
> _______________________________________________
> 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
>
--
------------------------
Dr. John Buckley
email@hidden
Mac OS X Tiger
------------------------
_______________________________________________
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