Re: NSArrayController with Combo Boxes, etc.
Re: NSArrayController with Combo Boxes, etc.
- Subject: Re: NSArrayController with Combo Boxes, etc.
- From: "Kent A. Signorini" <email@hidden>
- Date: Sun, 11 Jan 2004 09:00:54 -0700
What if I were to rebuild the Combatant object so that the 3 weapons
with their 3 damage ratings were an array of "Weapons" objects (let's
call it weaponArray) with the Weapons objects having a name and a
damage rating.
Then I create an NSArrayController to handle the 3 weapons in any
fields that look at them on the page by binding the new
WeaponsArrayController's content array to the CombatantController's
selection.weaponArray?
Would that work? Can one NSArrayController get it's content data from
an array that's part of an object which is the current selection of
another NSArrayController?
Thanks,
Kent!
On Jan 10, 2004, at 10:00 PM, mmalcolm crawford wrote:
On Jan 10, 2004, at 8:38 PM, Kent A. Signorini wrote:
I am using an NSArrayController with an array of objects I've created.
To make this simpler, I'll only mention the required object variables.
The object is called Combatant and each one has the following:
name weapon 1 weapon 2 weapon 3 weapon 1 damage weapon 2 damage
weapon 3 damage shield rating
Now I have a section of my document that includes an NSComboBox. In
that combo box I want the data to fill with the names of the three
weapons for the currently chosen combatant.
THEN, for whichever weapon is chosen, another NSTextField will display
that chosen weapon's damage rating.
Is this difficult to do? How would I do it?
It'll probably be very fiddly, in particular because each weapon is
represented by two separate values, and the weapons themselves are
individual ivars, not grouped in an array.
You could probably do this by creating indexed array accessors for
weapons ("fudge" the count by just returning '3' from countOfWeapons)
and for each item returning a dictionary containing the weapon's name
and damage.
Is there any reason for using a ComboBox rather than a PopUp? Is the
user going to be able to edit the name of the weapon directly (this
*may* -- I haven't thought it through fully -- affect the ease of
implementation)?
mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.