Documentation Archive Developer
Search
PATH  Documentation > WebObjects 4.5 > EOInterface Reference

Table of Contents

EOControlAssociation


Inherits from:
EOGenericControlAssociation : EOAssociation : EODelayedObserver (EOControl) : NSObject
Implements:
EOObserving (EODelayedObserver)
Package:
com.apple.yellow.eointerface


Class Description


EOControlAssociation is the default EOAssociation subclass for use with NSControl objects (Application Kit).


Note: This class doesn't exist in the com.apple.client.eointerface package.

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 controlTextShouldBeginEditing and controlDidFailToFormatStringErrorDescription.


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.




Constructors



EOControlAssociation

public EOControlAssociation(Object aDisplayObject)

Creates a new EOControlAssociation to monitor and update the row values in aDisplayObject, an NSControl object (Application Kit).

You normally set up associations with the Interface Builder application, in which case you don't need to create them programmatically. However, if you do create them up programmatically, setting them up is a multi-step process. After creating an association, you must bind its aspects and establish its connections.

See Also: bindAspect (EOAssociation), establishConnection (EOAssociation)




Table of Contents