Re: Using NSTextField value without changing focus?
Re: Using NSTextField value without changing focus?
- Subject: Re: Using NSTextField value without changing focus?
- From: Koen van der Drift <email@hidden>
- Date: Tue, 11 Sep 2012 12:41:55 -0400
On Tue, Sep 11, 2012 at 11:26 AM, Keary Suska <email@hidden> wrote:
> On Sep 11, 2012, at 7:17 AM, Koen van der Drift wrote:
>
>> And as a followup, I am using bindings to link the value of the
>> textfield to my controller to do the calculations. I als tried
>> checking "Continuously Updates Value" in IB, but that also didn't
>> work, I still need to unfocus the textfield for the new value to be
>> used.
>
> "Continuously Updates Value" is what you want, usually. I bet that if you put NSLogs in the setters you will find that they are being set immediately. If this isn't working, it means that your calculation method is not working on the same model as the bindings, or at least not an up-to-date copy, which is generally a bad idea. The calculation method should retrieve the values directly from the model owner on demand, which will do what you need.
Without being able to look at my project since I am not at my Mac, I'm
pretty sure I set it up correctly. The myViewController class which
does the calculations has @properties for the values stored in the
textfields, and in IB the textfields are bound to
myViewController.value1, etc. The are no setters/getters for these
values.
Another thought I had why it doesn't work, is that I connected a
formatter to the textfield in IB to allow integers only. Could that
be related to what I am seeing?
Once I get back to my Mac, I'll check all bindings and try the
continously updates value box again.
- Koen.
_______________________________________________
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