Re: Binding beginner question
Re: Binding beginner question
- Subject: Re: Binding beginner question
- From: Keary Suska <email@hidden>
- Date: Wed, 28 Jun 2006 14:02:20 -0600
- Thread-topic: Binding beginner question
on 6/28/06 11:43 AM, email@hidden purportedly said:
> 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?
There are many correct ways, and this is likely one of them.
> Perhaps there is a way without creating the BOOL and not involve
> manual programming?
Not that I know of. AFAIK, your model object must have the proper instance
variable, and you must have the proper accessors for it.
> 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?
This behavior is odd, since the edit should be automatically committed
anytime the field resigns first responder status, unless the entered value
is invalid from the perspective of the formatter, or your field value
binding is set. Otherwise, we may need more information to help.
Best regards,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
_______________________________________________
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