Inherits from: NSMatrix : NSControl : NSView : NSResponder : NSObject
Conforms to: NSCoding
(NSResponder)
NSObject (NSObject)
Declared in: AppKit/NSForm.h
An NSForm is a vertical NSMatrix of NSFormCells. Here's an example:
In NSForm's methods, each NSFormCell is called an "entry" (or, sometimes, a "cell" or "item"). The left part of each entry is called the "title," and the right part is called the "text." Methods that refer to individual entries use an one-dimensional "index"; the indexing system starts at the top of the top of form, with zero.
Any entry in the form can be "selected." When an entry is selected, its text area responds to the user's keystrokes. You can select an entry using the selectTextAtIndex: method, or you can let the user select an entry by clicking it with the mouse. Once an entry is selected, the user can select the next entry by pressing Tab, or select the previous entry by pressing Shift-Tab.
To initiate the action of a selected entry, the user presses Return or Enter. In response, the entry sends an action message to its target. If the entry has no target, the NSForm sends an action message to its target.
NSForm includes a methods to change the appearance of entries (the set... methods). These methods affect every entry in the form. To change the appearance of an individual entry, you need to single it out, using cellAtIndex:, and then send it messages appropriate to an NSFormCell.
For more information, see the class specifications for NSFormCell and NSMatrix.
- Adding and removing entries
- - addEntry:
- - insertEntry:atIndex:
- - removeEntryAtIndex:
- Changing the appearance of all the entries
- - setBezeled:
- - setBordered:
- - setEntryWidth:
- - setInterlineSpacing:
- - setTitleAlignment:
- - setTextAlignment:
- - setTitleFont:
- - setTextFont:
- Getting cells and indices
- - indexOfCellWithTag:
- - indexOfSelectedItem
- - cellAtIndex:
- Displaying a cell
- - drawCellAtIndex:
- Editing text
- - selectTextAtIndex:
- (NSFormCell *)addEntry:(NSString
*)title
See Also: - insertEntry:atIndex:, - setEditable: (NSCell), - setTag: (NSActionCell), - setTarget: (NSActionCell), - setAction: (NSActionCell) - setEnabled: (NSActionCell)
- (id)cellAtIndex:(int)entryIndex
See Also: - indexOfCellWithTag:, - indexOfSelectedItem
- (void)drawCellAtIndex:(int)entryIndex
See Also: - indexOfCellWithTag:, - indexOfSelectedItem
- (int)indexOfCellWithTag:(int)tag
See Also: - tag(NSCell)
- (int)indexOfSelectedItem
- (NSFormCell *)insertEntry:(NSString
*)title atIndex:(int)entryIndex
Returns the newly inserted NSFormCell.
See Also: - addEntry:, - removeEntryAtIndex:
- (void)removeEntryAtIndex:(int)entryIndex
- (void)selectTextAtIndex:(int)entryIndex
- (void)setBezeled:(BOOL)flag
YES
,
sets all the entries in the form to show a bezel around their editable
text; if flag is NO
,
sets all the entries to show no bezel.See Also: - setBordered:, - isBezeled (NSCell)
- (void)setBordered:(BOOL)flag
YES
,
they display a border; otherwise, they don't. An entry can have
a border or a bezel, but not both.See Also: - setBezeled:, - isBordered (NSCell)
- (void)setEntryWidth:(float)width
- (void)setInterlineSpacing:(float)spacing
- (void)setTextAlignment:(int)alignment
See Also: - setTitleAlignment:
- (void)setTextFont:(NSFont
*)font
See Also: - setTextFont:
- (void)setTitleAlignment:(NSTextAlignment)alignment
See Also: - setTextAlignment:
- (void)setTitleFont:(NSFont
*)font
See Also: - setTextFont: