NSControl is an abstract class that defines the
common interface and behavior for user interface
controls. It provides the basic functionality for
controls that use NSCell objects to display content
and handle user interaction. NSControl manages the
relationship between the control and its cell,
handles target-action messaging, and provides methods
for value management and display. Key features include: -
Cell-based architecture for content display and
editing - Target-action mechanism for user
interaction - Value management with type
conversion methods - Text formatting and editing
support - Mouse tracking and event handling -
Integration with field editor for text input
NSControl is subclassed by concrete controls like
NSButton, NSTextField, NSSlider, and others that
implement specific user interface elements.
Aborts current editing session and discards changes.
Returns: YES if editing was
successfully aborted, NO
otherwise
Sends an
[NSCell -endEditing:]
message to the current object used to edit the
NSControl. Returns NO if the the
currentEditor does not exists,
YES otherwise.
Returns the text alignment used by the control.
Returns: The NSTextAlignment value indicating text
alignment
Returns the alignment of the text in the
NSControl's cell. Returns
NSNaturalTextAlignment if the cell
does not exists. See
NSTextAlignment
for more informations.
Simulates a mouse click on the control. sender:
The object requesting the click simulation
Simulates a single mouse click on the control.
This method calls the cell's method
performClickWithFrame:inView:.
Take note that sender is not used.
- (BOOL) sendAction: (SEL)theAction to: (id)theTarget;
Availability: OpenStep
Sends the specified action to the specified target.
theAction: The action selector to send
theTarget: The target object to receive the
action Returns: YES if the action was
successfully sent, NO otherwise
Asks the NSApplication to send an action
theAction with theTarget as
target to NSControl. Returns NO if
theAction is nil or if
NSApplication can not send the action.
Sets the text alignment used by the control. mode: The
NSTextAlignment value to use for text
alignment
Sets the alignment of the text in the NSControl's
cell to mode. This method abort the
editing and marks self for display if the cell is
an NSActionCell. See
NSTextAlignment
for more informations.
Sets the floating point number format for the control.
autoRange: YES to automatically
determine range, NO for fixed format
leftDigits: Number of digits to display to the
left of decimal point rightDigits: Number of digits to
display to the right of decimal point
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
Warning the underscore at the start of the
name of this instance variable indicates that, even
though it is not technically private, it is
intended for internal use within the package, and
you should not use the variable in other code.
Notifies when string formatting fails
for the control. control: The NSControl
object where formatting failed string: The
string that failed to format error:
Description of the formatting error
Returns: YES if the error
was handled, NO otherwise
Notifies when partial string validation
fails. control: The NSControl object where
validation failed string: The partial
string that failed validation error:
Description of the validation error
Validates an object value for the
control. control: The NSControl
object requesting validation object: The
object value to validate Returns:
YES if the object is valid,
NO otherwise
Determines whether text editing should begin in
the control. control: The NSControl object
requesting to begin editing fieldEditor: The
NSText object that will serve as the field editor
Returns: YES to allow editing to
begin, NO to prevent it
Determines whether text editing should end in
the control. control: The NSControl object
requesting to end editing fieldEditor: The
NSText object serving as the field editor Returns:
YES to allow editing to end,
NO to continue editing
Provides completions for partial word input during
text editing. control: The NSControl object requesting
completions textView: The NSTextView object
handling the editing words: Array of potential
completion words charRange: The
character range of the partial word index:
Pointer to store the index of the
preferred completion Returns: Array of completion
strings to display
Handles command selector execution
during text editing. control: The NSControl object
where the command occurred textView: The
NSTextView object handling the editing command:
The selector representing the command to
execute Returns: YES if the
command was handled, NO to
use default handling
This protocol defines methods that delegates can
implement to control and respond to text editing
operations in NSControl objects. It provides
fine-grained control over validation,
formatting, and editing behavior.