Documentation Archive Developer
Search
PATH  WebObjects 4.0 Documentation > EOInterface Reference



EOControlAssociation

Inherits From:
EOGenericControlAssociation :
EOAssociation :
EODelayedObserver (EOControl) :
NSObject

Conforms To: NSCoding (EOAssociation)
EOObserving (EODelayedObserver)
NSObject (NSObject)

Declared in: EOInterface/EOControlAssociation.h


Class Description

EOControlAssociation is the default EOAssociation subclass for use with NSControl objects (Application Kit). A control association displays the value of the selected object in its control, and updates the object when the control's value changes. A sibling class, EOActionCellAssociation, can be used with individual cells in an NSMatrix or NSForm (both defined in the Application Kit). Some other subclasses of EOAssociation, such as EOPopUpAssociation and EOColumnAssociation, supersede these classes for more specialized behavior.

EOControlAssociations access values using NSControl's


setObjectValue: method, which allows values with non-string representations to be displayed. An EOControlAssociation can be bound to an NSImageView, for example, with an attribute whose class is NSImage (both NSImageView and NSImage are defined in the Application Kit).

Usable With
Any NSControl (Application Kit)

Aspects
value An attribute of the selected object, displayed in the NSControl.
enabled A boolean attribute of the selected object, which determines whether the NSControl is enabled.

Object Keys Taken
target On receiving an action message from the NSControl, an EOControlAssociation sends the NSControl's value to the EODisplayGroup.
delegate An EOControlAssociation accepts messages related to editing and validation of text, such as
control: textShouldBeginEditing: and
controlDidFailToFormatStringErrorDescriptioncontrol: didFailToFormatString:errorDescription: .


Examples

To display a movie's budget in an NSTextField, in Interface Builder, control-drag a connection from the text field and a Movie display group. In the Connections inspector, choose EOControlAssociation, and bind the value aspect to the "budget" key. Then, if the NSTextField 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 NSTextField uneditable depending on the selected movie. To do so, bind the enabled aspect to the "isBudgetNegotiable" key.


Instance Methods


control

- (NSControl *)control

Returns the receiver's control object. For EOControlAssociation, this method is equivalent to EOAssociation's object method.


editingAssociation

- (EOGenericControlAssociation *)editingAssociation

Returns self.





Copyright © 1998, Apple Computer, Inc. All rights reserved.