Re: Binding an objects "Enabled" to a button in IB
Re: Binding an objects "Enabled" to a button in IB
- Subject: Re: Binding an objects "Enabled" to a button in IB
- From: Joanna Carter <email@hidden>
- Date: Mon, 30 Aug 2010 13:42:44 +0100
Le 30 août 2010 à 13:26, email@hidden a écrit :
> Can the following be done completely in the nib file (in IB)?
>
> I have a form field whos fields are bound to various attributes of an
> object (the object Person has attributes as firstName, lastName, etc.). In
> my view I would like lock these fields, prohibiting them from being
> changed, i.e. I'd like to be able to toggle the forms' "Enabled"-binding
> between YES and NO. For this I'd like to use a simple button named "Lock".
>
> Can this binding be done in IB or do I need to add this functionality
> programatically?
The usual way to handle this would be to have a simple boolean property on the controller class and, assuming the "Lock" button is a two-state button, to bind the State property of the "Lock" button and the Enabled property of anything else to that boolean property, thus when the button's State is true, the other controls will be enabled.
Joanna
--
Joanna Carter
Carter Consulting
_______________________________________________
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