EOComboBoxAssociation

Inherits From:
EOAssociation : EODelayedObserver : NSObject

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

Declared in: EOInterface/EOComboBoxAssociation.h

Class At a Glance:

Purpose

An EOComboBoxAssociation displays a single attribute or to-one relationship value from a list of possible values. The titles aspect is typically bound to an attribute of the destination entity's EODisplayGroup, and one of the selectedTitle or selectedObject aspects is bound to the source entity's EODisplayGroup. EOComboBoxAssociation is very similar to the EOPopUpAssociation.

Usable With

NSComboBox

Aspects

titles
Property of the enterprise objects in the EODisplayGroup containing the title for the items in the NSComboBox list.
selectedTitle
String property of the enterprise object containing the title to be displayed in the NSComboBox. When the value of NSComboBox changes either because a new value is typed in or from a selection made using the popup, the new text value is assigned to this property.
selectedObject
Relationship property of the enterprise object containing the enterprise object to select from the titles EODisplayGroup. selectedObject is usually mutually exclusive with selectedTitle. When the value of the NSComboBox changes, the association updates the relationship to point to the new object.
enabled
A boolean attribute of the selected object that determines whether the NSComboBox is enabled.

Object Keys Taken

target
When the user chooses an item in the pop-up list, the EOComboBoxAssociation updates the selected object's property with the item's title or object.
dataSource
When the NSComboBox requests values for its list through the NSComboBoxDataSource informal protocol, the EOComboBoxAssociation provides them by querying the appropriate EODisplayGroup or groups.
delegate
An EOComboBoxAssociation accepts the message comboBoxSelectionDidChange: .

Class Description

EOComboBoxAssociation displays an attribute or to-one relationship value in an NSComboBox. The items in the NSComboBox can be entered manually, or for a relationship, constructed dynamically from values supplied by the EODisplayGroup bound to the titles aspect. The value displayed by the NSComboBox can be bound by one of two aspects: selectedTitle , which is useful for values representable as strings; and selectedObject , for the destination object of a relationship.

Examples

Selecting a string from a static list: Suppose you have a Movie display group and you want to provide a ComboBox for setting the rating. In this example the rating is a string property of the Movie object rather than a relationship to a Rating enterprise object. Type the list of ratings into the ComboBox in Interface Builder, and then bind the selectedTitle aspect to the "rating" property of the Movie display group.

Selecting a string from a dynamic list: This example is similar to the previous one, except that you're filling the ComboBox from the "ratingString" property of an EODisplayGroup containing an array of Rating objects fetched from an external source. Bind the titles aspect to the "ratingString" property of the Ratings display group, and bind the selectedTitle aspect to the "rating" property of the Movie display group.

Selecting an enterprise object to assign to a to-one relationship: Suppose you have a list of employees and want to assign each employee a department. In terms of the object model, you want to assign a Department enterprise object to the "department" property of an Employee enterprise object. Bind the titles aspect to the "name" property of a Department display group, and bind selectedObject to the "department" relationship property of the Employee display group.

If the selectedObject aspect is bound and the user types in a value that doesn't match any of those currently in the list, an error panel is displayed.

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