Introduction to Control and Cell Programming Topics for Cocoa
Explains the relationship between Cocoa control and cell objects.
Organization of This Document
Controls and cells implement user-interface objects, like buttons, text fields, and sliders. The control is responsible for
- Displaying itself
- Intercepting user events (such as a clicking a button or moving a slider)
- Sending actions to other objects, usually in response to a user event (such as changing a variable’s value as a slider moves or performing a command when a button is pressed.)
A control usually delegates the first two responsibilities to cells. Splitting these responsibilities off makes it easier to create a control with many identical elements (like a spreadsheet table) or with a few different elements (like a pull-down list that lets you enter a string either in a text field or from a menu of pre-elected strings).
Here are the concepts:
- About Cells and Controls gives basic information on what the NSCell and NSControl classes do.
- How Controls and Cells Interact gives more information on how controls and cells interact and how they operate.
- Cell States describes the three states a control can have: on, off, or mixed. Although used primarily by NSButton, states are defined in NSCell so future subclasses can use them.
- Represented Objects explains how to associate a cell with the object it represents.
Here are the tasks:
- "Manipulating Cells and Controls" discusses various tips and techniques for dealing with cells and controls.
- Changing the Cell for a Control describes how to change the NSCell subclass that a control uses.
- Displaying Cell Values describes how some cells format and display their values as strings.
- Validating Control Entries describes how to validate the contents of some cells, especially cells in a matrix or text field.
- Using a Continuous Control describes how to set up a control so it sends its action message repeatedly while being pressed.
- Subclassing NSCell and Subclassing NSControl describe how to create custom subclasses of NSCell and NSControl.
- Using the System Control Tint describes how to use the system-wide control tint in your custom views and control cells.
Copyright © 2008 Apple Inc. All Rights Reserved. Terms of Use | Privacy Policy | Updated: 2008-10-15