• 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: Cocoa Bindings, NSMatrix, setting programmatically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Cocoa Bindings, NSMatrix, setting programmatically


  • Subject: Re: Cocoa Bindings, NSMatrix, setting programmatically
  • From: Renaud Boisjoly <email@hidden>
  • Date: Wed, 28 Apr 2004 08:46:56 -0400

Let me try another shot at describing the setup...

I have a view which contains an NSMatrix of NSButtonCells. Basically, radio buttons. Instead of using radio buttons, I actually use only the text label. I end up with an NSMatrix containing the days of the week. I use list mode of the NSMatrix to allow the user to select more than one day of the week.

I've created an NSArrayController to manage an object which contains different properties, like an event name, weekdays it should occur on, hours it should occur on, etc.

I've bound the NSMatrix's selectedValues to my NSArrayController using "selectedObjects" and the value "weekdays".

It seems to work fine. I can make a selection and it sticks.

But by default, when I run my app and create a new event, the NSMutableArray called weekdays, is set to NULL, although the NSMatrix has a single day selected. When I click on a day, then, the array is set to contain that day. But when I set the array programmatically, using [self setAllWeekdays:[NSMutableArray arrayWithObject:@"Monday"]; the array is set, but the interface doesn't reflect it.

Am I wrong in assuming the content of this array is a simple NSString? Must I use a reference to the NSCell itself (where am I going to get that, through an outlet perhaps?

Sorry, I'm a newbie at all this, thanks for all your help! Let me know if this isn't clearer...

- Renaud

On Apr 27, 2004, at 11:54 PM, Allan Odgaard wrote:

Sorry, but I wasn't able to follow your setup. However, setting the value of a bound property depends on how it is bound. If it is a to-one property, then using the set<Key>: method will generate the proper notification for the observers and thus is the way.

If it is a to-many (like an NSArray) then use mutableArrayValueForKey: and change the returned array, that will ensure proper notifications are sent.

If this doesn't help, and no-one else picks up on your question, then providing some source code might help understanding your setup.
_______________________________________________
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: Cocoa Bindings, NSMatrix, setting programmatically
      • From: Allan Odgaard <email@hidden>
References: 
 >Cocoa Bindings, NSMatrix, setting programmatically (From: Renaud Boisjoly <email@hidden>)

  • Prev by Date: Re: Releasing a sub-view
  • Next by Date: Re: Releasing a sub-view
  • Previous by thread: Re: Cocoa Bindings, NSMatrix, setting programmatically
  • Next by thread: Re: Cocoa Bindings, NSMatrix, setting programmatically
  • Index(es):
    • Date
    • Thread