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 15:15:38 -0500
Well, I was halfway there -- I had one side of the custom bindings
implemented. I did as you said and now everything is working
perfectly! Thanks so much!
Larry
On 4/28/06, John Buckley <email@hidden> wrote:
On 28/04/06, Lawrence Sanbourne <email@hidden> wrote:
>
> 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
I had no luck with the 'standard' NSMatrix binding keys and added my own:
items
selectionIndexes
"items" is bound to my array controller's arrangedObjects and
"selectionIndexes" to... selectionIndexes. I implemented
observeValueForKeyPath: ofObject: change: context: and handle layout
and selection changes there. Then in mouseDown: (or in the various
select* methods) I make sure that the selectionIndexes changes are
propagated back to the object I am observing.
Maybe my implementation is overkill; but I couldn't get the
multicolumn layout/selection behaviour I wanted with the standard
bindings.
Regards,
John
>
> > 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
> > ------------------------
> >
>
--
------------------------
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