• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSArrayController with Combo Boxes, etc.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

  • Follow-Ups:
    • Re: NSArrayController with Combo Boxes, etc.
      • From: mmalcolm crawford <email@hidden>
References: 
 >NSArrayController with Combo Boxes, etc. (From: "Kent A. Signorini" <email@hidden>)
 >Re: NSArrayController with Combo Boxes, etc. (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: how to setMovableByWindowBackground?
  • Next by Date: Extremely confused, GWorlds and CopyBits
  • Previous by thread: Re: NSArrayController with Combo Boxes, etc.
  • Next by thread: Re: NSArrayController with Combo Boxes, etc.
  • Index(es):
    • Date
    • Thread