An action cell defines an active area inside a control (an instance of NSControl or one of its subclasses). As an NSControl’s active area, an action cell does three things: it usually performs display of text or an icon; it provides the NSControl with a target and an action; and it handles mouse (cursor) tracking by properly highlighting its area and sending action messages to its target based on cursor movement.
NSActionCell implements the target object and action method
as defined by its superclass, NSCell. As a user manipulates an NSControl,
NSActionCell’s trackMouse:inRect:ofView:untilMouseUp:
method
(inherited from NSCell) updates its appearance and sends the action
message to the target object with the NSControl object as the only
argument. See “Targets and Actions.”
Usually, the responsibility for an NSControl’s appearance and behavior is completely given over to a corresponding NSActionCell. (NSMatrix, and its subclass NSForm, are NSControls that don’t follow this rule.)
A single NSControl may have more than one NSActionCell. To help identify it in this case, every NSActionCell has an integer tag. Note, however, that no checking is done by the NSActionCell object itself to ensure that the tag is unique. See NSMatrix for an example of a subclass of NSControl that contains multiple NSActionCells.
Many of the methods that define the contents and look of an
NSActionCell, such as setFont:
and setBordered:
,
are reimplementations of methods inherited from NSCell. They’re
overridden to ensure the NSActionCell is redisplayed when “visual”
attributes change.
Last updated: 2002-11-12