Return to the Alphabetic Index
Return to the Class Browser
Return to the Picture Browser
Copyright (c) 1994 by NeXT Computer, Inc. All Rights
Reserved.
NSForm
Inherits From: NSMatrix : NSControl : NSView : NSResponder : NSObject
Conforms To: NSCoding (NSResponder)
NSObject (NSObject)
Declared In: AppKit/NSForm.h
Class Description
An NSForm is an NSMatrix that contains titled entries (text fields) into which
a user can type data values. Entries are indexed from the top down (starting
with zero). Each item in the NSForm, including the titles, is an NSFormCell. A
mouse click on an NSFormCell (that is, on the title or in the entry area)
starts text editing in that entry. If the user presses the Return or Enter key
while editing an entry, the action of the entry is sent to the target of the
entry, orif the entry doesn't have an actionthe NSForm sends its
action to its target. If the user presses the Tab key, the next entry in the
NSForm is selected; if the user presses Shift-Tab, the previous entry is
selected.
For more information, see the NSFormCell and NSMatrix class specifications.
Laying Out the Form
- - (NSFormCell *)addEntry:(NSString *)title Adds and returns a new
entry with title as its title at the end of the Form.
- - (NSFormCell *)insertEntry:(NSString *)title Inserts a new entry
at index with title as its title.
atIndex:(int)index
- - (void)removeEntryAtIndex:(int)index Removes the entry at
index.
- - (void)setInterlineSpacing:(float)spacing Sets the spacing
between entries to spacing.
Finding Indices
- - (int)indexOfCellWithTag:(int)aTag Returns the index for the
entry with tag aTag.
- - (int)indexOfSelectedItem Returns the index of the currently selected
entry.
Modifying Graphic Attributes
- - (void)setBezeled:(BOOL)flag Sets whether entries have a bezeled
border.
- - (void)setBordered:(BOOL)flag Sets whether the entries have a
plain border.
- - (void)setTextAlignment:(int)mode Sets how text is aligned
within the entries to mode.
- - (void)setTextFont:(NSFont *)fontObject Sets the font used to
draw entry text to fontObject.
- - (void)setTitleAlignment:(NSTextAlignment)mode Sets how titles
are aligned to mode.
- - (void)setTitleFont:(NSFont *)fontObject Sets the font used to
draw entry titles to fontObject.
Setting the Cell Class
- + (Class)cellClass Returns the class last set in a setCellClass:
message, or the NSFormCell class if setCellClass: has never been
called.
- + (void)setCellClass:(Class)classId Sets the class of NSCell used
in the NSForm.
Getting a Cell
- - (id)cellAtIndex:(int)index Returns the Cell at index.
Displaying a Cell
- - (void)drawCellAtIndex:(int)index Displays the Cell at the
specified index.
Editing Text
- - (void)selectTextAtIndex:(int)index Selects the text in the
entry at index.
Resizing the Form
- - (void)setEntryWidth:(float)width Sets the width of all the
entries (including the title part) to width.