• 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 NSTextField to update (and transform)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Force NSTextField to update (and transform)


  • Subject: Re: Force NSTextField to update (and transform)
  • From: Michał Glenc <email@hidden>
  • Date: Mon, 29 Jun 2009 10:02:38 +0200

Hi,
Thanks for the advice. I was using bindings just to create a simple application.
I found a simple workaround for this problem. I added an IBAction in controller, which handles value change in ComboBox. When user picks up a currency, a message to the transformer is sent in order to set the value of ivar (the one that TextField is binded to) to the value of the same TextField. Now everything works fine.


On 2009-06-29, at 07:00, mmalc Crawford wrote:

On Jun 26, 2009, at 5:37 AM, Michał Glenc wrote:

I'm a beginner in Cocoa world and I have some problems with bindings, NSValueTransformer etc.

Cocoa bindings is not a beginner technology. You are encouraged to gain some experience with Cocoa before using bindings.

My application performs basic currency transforming. I have two NSComboBoxes (where I change currency) and two NSTextFields. Everything works fine, the values get transformed. However, when I change currency in one of ComboBoxes (after values in TextField have been already entered), value in TextField stays unchanged. What I want to achieve is to send the TextField (or perhaps the NSValueTransformer) a message that it's value has been changed (so that it retransforms) when the currency in ComboBox is changed. Could you advise me something?

What value is the combo box changing? If it is simply changing a value that the value transformer uses, then this will not effect a change in the text fields. The text fields will only update if the model value they represent -- or a value upon which the model value depends -- is updated.

(I may be missing something obvious here, but offhand...) If you had a controller object that manages the values in the text field and the exchange rate, then you could make the converted amount dependent on the values of the source amount and the exchange rate -- you probably wouldn't need a value transformer, though.

mmalc

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


References: 
 >Force NSTextField to update (and transform) (From: Michał Glenc <email@hidden>)
 >Re: Force NSTextField to update (and transform) (From: mmalc Crawford <email@hidden>)

  • Prev by Date: Re: GC pros and cons
  • Next by Date: Columns widths specified programmatically seem to be wider.
  • Previous by thread: Re: Force NSTextField to update (and transform)
  • Next by thread: How to get a fully transparent hit-testable window?
  • Index(es):
    • Date
    • Thread