Re: NSArrayController with Combo Boxes, etc.
Re: NSArrayController with Combo Boxes, etc.
- Subject: Re: NSArrayController with Combo Boxes, etc.
- From: mmalcolm crawford <email@hidden>
- Date: Sat, 10 Jan 2004 21:00:31 -0800
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.