Binding beginner question
Binding beginner question
- Subject: Binding beginner question
- From: Johan Augustsson <email@hidden>
- Date: Wed, 28 Jun 2006 12:43:38 -0500
Hi
I just started to experiment with cocoa bindings. I have set up my
application like this:
Textfield is normally non editable. When I check my checkbox "Make
Editable" I want the textfield to be editable and vice versa. I
solved it like this:
I have a boolean in my NSWindowController that stores the active
value (BOOL textFieldIsEditable)
The checkbox's value is bound to the BOOL
The TextField's editable is bound to the BOOL
My first question is if this is the correct way to solve the problem?
Perhaps there is a way without creating the BOOL and not involve
manual programming?
The second problem is more problematic.
If I doesn't press enter before I uncheck my checkbox the value
entered in the textfield is lost. I quess I need to do send the
window "makeFirstResponder:nil" to let the texfield evaluate the
formatter and decide if it's possible to let me quit the edit phase.
Is this possible or how do I solve my problem?
Another thought was not to use binding with the checkbox, but let an
action change the BOOL programatically. The problem is that the
textfield (connected to the BOOL with bindings) doesn't change if I
manually change my BOOL in XCode.
Thank you very much
_______________________________________________
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