EOActionCellAssociation
- Inherits from:
- EOGenericControlAssociation : EOAssociation : EODelayedObserver (EOControl) : NSObject
- Conforms to:
- NSCoding
- (EOAssociation)
- EOObserving (EODelayedObserver)
- NSObject (NSObject)
Declared in:
- EOInterface/EOControlAssociation.h
Class Description
EOActionCellAssociation is the default association class for use with NSActionCells (Application Kit).
An EOActionCellAssociation object displays the value of the selected object in its NSActionCell, and updates the object when the NSActionCell's value changes. A sibling class, EOControlAssociation, can be used with independent controls such as NSButtons and NSTextFields. Other associations, such as EOPopUpAssociation and EOColumnAssociation, supersede these classes for more specialized behavior.
When multiple EOActionCellAssociations are bound to cells in the same control (such as in an Application Kit NSMatrix), one of them becomes the delegate of the control and forwards appropriate messages, such as control:isValidObject:, to the others. This eliminates the need to add an EOControlAssociation just to handle delegate messages.
EOActionCellAssociations access values using NSActionCell's setObjectValue: method, which allows values with non-string representations to be displayed. An EOActionCellAssociation can be bound to an NSImageCell, for example, with an attribute whose class is NSImage.
Usable With |
Any NSActionCell |
Aspects | |
value | An attribute of the selected object, displayed in the NSActionCell. |
enabled | A boolean attribute of the selected object, which determines whether the NSActionCell is enabled. |
Object Keys Taken | |
target | On receiving an action message from the NSActionCell, an EOActionCellAssociation sends the NSActionCell's value to the EODisplayGroup. |
delegate | See the class description. |
Examples
To display a movie's budget in an NSTextFieldCell, in Interface Builder, control-drag a connection from the text field to the Movie display group. Select EOActionCellAssociation in the Connections inspector, and bind the value aspect to the "budget" key. Then, if the NSTextFieldCell is editable, when the user types a new value and presses Enter or Tab, the selected movie's budget attribute is changed.
Assuming that Movie objects implement an isBudgetNegotiable method, you can make the NSTextFieldCell uneditable depending on the selected movie. To do so, bind the enabled aspect to the "isBudgetNegotiable" key.
Instance Methods
control
- (NSControl *)control
See Also: - object (EOAssociation), - controlView (NSActionCell class of the Application Kit)
editingAssociation
- (EOGenericControlAssociation *)editingAssociation