Inherits from | |
Conforms to | |
Framework | /System/Library/Frameworks/AppKit.framework |
Availability | Available in Mac OS X v10.0 and later. |
Declared in | NSForm.h |
Companion guides |
An NSForm
object is a vertical matrix of NSFormCell
objects. Here’s an example:
An NSForm
object uses NSFormCell to implement its user interface.
– setBezeled:
– setBordered:
– setEntryWidth:
– setFrameSize:
– setInterlineSpacing:
– setTitleAlignment:
– setTitleBaseWritingDirection:
– setTextAlignment:
– setTextBaseWritingDirection:
– setTitleFont:
– setTextFont:
Adds a new entry to the end of the receiver and gives it the specified title.
- (NSFormCell *)addEntry:(NSString *)title
The title for the new form entry.
The form cell object that was created for the entry.
The new entry has no tag, target, or action, but is enabled and editable.
– insertEntry:atIndex:
– setEditable:
(NSCell)– setTag:
(NSActionCell)– setTarget:
(NSActionCell)– setAction:
(NSActionCell)– setEnabled:
(NSActionCell)NSForm.h
Returns the entry at the specified index.
- (id)cellAtIndex:(NSInteger)entryIndex
The index of the desired entry.
The form cell object at the specified index.
NSForm.h
Displays the entry at the specified index.
- (void)drawCellAtIndex:(NSInteger)entryIndex
The index of the entry to draw.
Because this method is called automatically whenever a cell needs drawing, you never need to invoke it explicitly. It is included in the API so you can override it if you subclass NSFormCell
.
NSForm.h
Returns the index of the entry whose tag is tag.
- (NSInteger)indexOfCellWithTag:(NSInteger)tag
The tag of the desired entry.
– tag
(NSCell)NSForm.h
Returns the index of the selected entry.
- (NSInteger)indexOfSelectedItem
The index of the selected entry, or -1
if no entry is selected.
NSForm.h
Inserts an entry with the specified title into the receiver.
- (NSFormCell *)insertEntry:(NSString *)title atIndex:(NSInteger)entryIndex
The title for the new form entry.
The zero-based index at which to insert the entry.
The form cell object that was created for the entry.
The new entry has no tag, target, or action, but is enabled and editable.
NSForm.h
Removes and releases the entry at the specified index.
- (void)removeEntryAtIndex:(NSInteger)entryIndex
The zero-based index identifying the desired entry.
If the specified index is invalid, this method does nothing.
NSForm.h
Selects the entry at the specified index.
- (void)selectTextAtIndex:(NSInteger)entryIndex
The index of the entry to select. If the specified index is invalid, this method does nothing.
NSForm.h
Sets whether the receiver's entries should display a bezel around their editable text.
- (void)setBezeled:(BOOL)flag
YES
to display a bezel around all entries; otherwise, NO
to show no bezel around all entries.
– setBordered:
– isBezeled
(NSCell)NSForm.h
Sets whether the receiver's entries should display a border around their editable text fields.
- (void)setBordered:(BOOL)flag
YES
to display a border around all entries; otherwise, NO
to show no border around all entries.
The border is drawn as a thin line around the editable text field. An entry can have a border or a bezel, but not both.
– setBezeled:
– isBordered
(NSCell)NSForm.h
Sets the width of all the entries in the receiver.
- (void)setEntryWidth:(CGFloat)width
The width of all entries, measured in points in the user coordinate space. This value represents the width of both the title and the text field.
NSForm.h
Sets the size of the receiver’s frame size to the specified value.
- (void)setFrameSize:(NSSize)newSize
The new size of the form.
The width of NSFormCell
objects always match the width of their encompassing NSForm
object. The cell width is always changed to match the view regardless of the value returned by autosizesCells
.
NSForm.h
Sets the spacing between entries
- (void)setInterlineSpacing:(CGFloat)spacing
The spacing between entries, measured in points in the user coordinate space.
NSForm.h
Sets the alignment for all of the receiver’s editable text.
- (void)setTextAlignment:(NSInteger)alignment
The alignment can be one of the following constants: NSRightTextAlignment
, NSCenterTextAlignment
, or NSLeftTextAlignment
.
The default alignment is NSLeftTextAlignment
.
NSForm.h
Sets the writing direction for the text content of every control embedded in the form.
- (void)setTextBaseWritingDirection:(NSWritingDirection)writingDirection
This value can be one of the following constants: NSWritingDirectionNatural
, NSWritingDirectionLeftToRight
, or NSWritingDirectionRightToLeft
.
– baseWritingDirection
(NSControl)NSForm.h
Sets the font for all of the receiver’s editable text fields
- (void)setTextFont:(NSFont *)font
The font to use for all editable text fields.
NSForm.h
Sets the alignment for all of the entry titles.
- (void)setTitleAlignment:(NSTextAlignment)alignment
The alignment can be one of the following constants: NSRightTextAlignment
, NSCenterTextAlignment
, or NSLeftTextAlignment
.
The default alignment is NSRightTextAlignment
.
NSForm.h
Sets the writing direction for the title of every control embedded in the form.
- (void)setTitleBaseWritingDirection:(NSWritingDirection)writingDirection
This value can be one of the following constants: NSWritingDirectionNatural
, NSWritingDirectionLeftToRight
, or NSWritingDirectionRightToLeft
.
NSForm.h
Sets the font for all of the entry titles.
- (void)setTitleFont:(NSFont *)font
The font to use for all entry titles.
NSForm.h
© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)