I've been reading docs and looking at IconCollection for the last week and I
still can't really figure this out.
Here's the behavior I want to model: pretend I'm making poker dice game. I
have a visual representation of the dice, and I want to select a certain
number of them each round.

Right now I'm using NSCollectionView with a prototype view that has a text
field (for a representation of the dice) and a button (for toggling
selection). Eventually I'll just use an image representation, but I'm just
trying to get this to work now.

When the user clicks the button in a view, the corresponding die will be
added into a "diceinhand" array in my AppController.
I can't figure out how, though, to connect the button in a way that
allows the AppController to understand which die has been selected
-- that is, I can't find any way to pass the representedObject associated
with my replicated view to any controller (but perhaps I'm thinking about
that incorrectly).

1. Can I call a selector on the representedObject itself from the view?
Where would I set that up that programmatically (I'm assuming you can't do
that with IB)?
2. Do I abandon the "selection buttons" and try and use the selection code
of NSCollectionView? Does that mean the user needs to shift-click to select
multiple dice? Do I then somehow listen to the selection changes on the
ArrayController via Key-Value observers? Since I'm just adding a reference
to the selected dice in another array, isn't there a way to bind my
DiceInHand array to the selection of my ArrayController?

I'm happy to read docs, it just seems that everything I've been reading
deals mostly with binding simple values in a prototype view.

Thank you,
Andrew
_______________________________________________

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