Hi,

In my program window, I have some kind of 'inspector' panel, containing an 
NSTableView object, bound to an NSArrayController, which in turn is bound to a 
NSMutableArray of DotController objects. These DotControllers control Dot 
objects, which are custom view objects. 

Adding or removing Dot objects in the program window is reflected correctly in 
the tableview, as rows are added or removed accordingly. Each table row 
correctly displays the Dot index number, X and Y coordinates. So far, so good.

Now, I would also like to use cocoa bindings to somehow link the table 
selection to my Dot objects and vice versa; ie. when I change the selection in 
the table, the corresponding Dot objects should become 'selected' (display in a 
different color), and when I click a Dot in my UI, the corresponding row in the 
table should get selected accordingly.

I wonder if someone could provide some general guidelines on how to implement 
this in IB using bindings.

I'm wondering if I should create a NSIndexSet property in my model object and 
bind it to the NSArrayController's 'selectedIndexes' key? But then, I should 
still somehow 'translate' the content of this indexset to the individual Dot 
(or DotController) objects in my model array…
Or, should I be able to use a BOOL 'selected' property of my DotController 
object and bind it directly to the NSArrayController's selectedIndexes?

I'm also wondering what would be needed, in this context, to get the Dot views 
to redraw themselves once their 'selected' property has been changed...

I hope all this is making some sense to someone on this list and I apologize 
for not being able to explain my problem more clearly.
Thanks for any suggestions.

-- 
Luc Van Bogaert




_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to