Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Bindings and Buttons
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bindings and Buttons



Am 21.07.2004 um 23:34 Uhr schrieb David Webster:

I would like to use bindings to enable/disable buttons based on the on/off state of other buttons.

You really shouldn't do that.

Instead your On/Off button should alter the state of some model data. Then you bind the enabled property of your second button to that model property through a controller.

The model controller might of course be the File's Owner. In that case you'll need an outlet to the first button (button1) and a variable to hold the state:

IBOutlet NSButton *button1;
BOOL button1State;

Now bind both, button1's 'value' binding and button2's 'enabled' binding, to <controller>.selection.button1State. Done.


Andreas
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >Bindings and Buttons (From: David Webster <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.