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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to