• 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: Force binding to set variable?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Force binding to set variable?


  • Subject: Re: Force binding to set variable?
  • From: Trygve Inda <email@hidden>
  • Date: Wed, 30 Aug 2006 12:30:51 +0000
  • Thread-topic: Force binding to set variable?

> On Aug 29, 2006, at 11:42 PM, Trygve Inda wrote:
>
>> How would you bind it to the controller vs the model? Can you give an
>> example?
>>
>> My object has an instance variable "dict" and I bind the controls
>> (mostly
>> checkboxes) to dict.someKeyName.
>>
>> Trygve
>
> I had to try out a test app since I've been working with Core Data
> lately. My normal bindings are a little fuzzy, I'm afraid.
>
> To a new project I simply added an NSObjectController which defaults
> to the class NSMutableDictionary. I added some keys and checked
> "automatically prepares content". I bound some checkboxes to those
> keys. I also added a button to log the dictionary by displaying
> [objectController content].
>
> What I found was that the dictionary was empty upon launch, not what
> I expected! So I also tried creating a model class to use as the
> Object Controller's content. Still empty on launch. So then I bound
> to the model directly. Same thing.
>
> I think I figured out the difference though. My experience has been
> with a custom view. I believe Views do get sent the initial values of
> the Model upon binding. For example, if I initialized the dictionary
> in the model's init method, so that a key was set to "on", then the
> corresponding checkbox was selected on launch since it was getting
> sent the bound value.
>
> But instead of the view, you want the model to get default values.
> Turns out a controller won't help that any. Sorry. Listen to Matt,
> not me. :)
>
> (I thought maybe there would be a way to enumerate through the
> controls to send their values to the model, but just setting the
> defaults initially would be easier anyway.)
>
> George

My experience exactly. I am just setting them manually in the init - oh
well!

Thanks,

Trygve


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >Re: Force binding to set variable? (From: George Orthwein <email@hidden>)

  • Prev by Date: Re: Something fishy going on PLEASE HELP
  • Next by Date: [SOLVED] Something fishy going on PLEASE HELP
  • Previous by thread: Re: Force binding to set variable?
  • Next by thread: Re: Force binding to set variable?
  • Index(es):
    • Date
    • Thread