• 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
appkit bindings question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

appkit bindings question


  • Subject: appkit bindings question
  • From: Daniel Luis dos Santos <email@hidden>
  • Date: Wed, 10 Sep 2008 17:56:01 +0100

Hello,

I have an application with a menu bar and some windows. They are all in the same nib that is loaded at application startup. One menu opens each one of those windows, where some data can be entered.

On one of those I have text fields binded through a NSObjectController to my data model object. The bindings work as expected.
The window has one apply and one cancel button. The window is put on screen calling [windowRef orderFront: evSource] , and hidden with a call to [windowRef orderOut: evSource].


When the app starts the accessor method of each model property is called. When the value of a field is changed when the focus leaves, the setter method is also called.

To be able to accept or reject the values entered in each field, I have made two sets of member variables on the model object. One is the binded property, the other is a variable that holds the last accepted value for that field. The accessors returns the last value accepted (when the window is shown it is supposed to have those in the text fields). The setters set the property values. When the apply button is clicked, those are assigned to the accepted value variables. When the cancel button is clicked no assignment occurs. In any case the window leaves the screen.

My problem is that when the window is put on screen again I need the text fields to reflect the model values that were accepted on the previous edit. In other words I need something that calls the accessor methods again on behalf of the text fields.

The only thing I can think of now is having outlets to the text fields and send them the message that is sent when focus leaves them (or setting the value manually). But this is the kind of thing bindings were made to avoid, right ? Is there any way of triggering the same binding event when the application starts that causes the update on the view ?

Another way is having each window in its own nib file and loading them each time I want to see or edit the fields. In that case where does the model object stand ? Is its life time the same as the view or can it exist before the view is created by loading the nib ?

Thanks


_______________________________________________ Do not post admin requests to the list. They will be ignored. Xcode-users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: SOLVED: How to build 64-bit for current architecture only?
  • Next by Date: Xcode environment variables
  • Previous by thread: duplicate symbols in debug build only
  • Next by thread: Xcode environment variables
  • Index(es):
    • Date
    • Thread