# NSMatrix

ovidiu@net-community.com
Generated at 2026-06-27 19:09:52 +0000

Matrix class for grouping controls

1996-2015 Free Software Foundation, Inc.
Software documentation for the NSMatrix class
AppKit/NSMatrix.h
NSCoding

TODO documentation

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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
cellClass

Returns the cell class used to create cells. By default it is a NSActionCell class

See Also: +setCellClass:

setCellClass:
classId

Sets the cell class used to create cells to classId. By default it is a NSActionCell class

See Also: +setCellClass:

acceptsFirstMouse:
theEvent

Returns `NO` if the NSMatrix's mode is NSListModeMatrix , `YES` otherwise.

See Also: -setMode: -mode

action
Description forthcoming.
addColumn

Inserts a new column after the current last column.

See Also: -insertColumn:withCells:

addColumnWithCells:
cellArray

Inserts a new column of cells specified by cellArray after the current last column.

See Also: -insertColumn:withCells:

addRow

Inserts a new row after the current last row.

See Also: -insertRow:withCells:

addRowWithCells:
cellArray

Inserts a new row of cells specified by cellArray after the current last row.

See Also: -insertRow:withCells:

allowsEmptySelection

Returns whether the matrix should permit empty selections or should force one or mor cells to be selected at all times.

See Also: -setAllowsEmptySelection:

autosizesCells

Returns whether the NSMatrix resizes its cells automatically

See Also: -autosizesCells

backgroundColor

Returns the background color The background color is used to display the NSMatrix color (the space between the cells), not the cells (uses -setCellBackgroundColor: for that)

See Also: -setBackgroundColor: -setCellBackgroundColor: -cellBackgroundColor -drawsBackground -setDrawsBackground:

cellAtRow:
row
column:
column

Returns the cell at row row and column column Returns `nil` if the row or column are out of range

cellBackgroundColor

Returns the background color of the NSMatrix's cells.

See Also: -setCellBackgroundColor: -backgroundColor -setBackgroundColor:

cellClass

Returns the cell class used by the NSMatrix when it creates new cells. The default cell class is a NSActionCell class

See Also: -setCellClass: -setPrototype: -prototype

cellFrameAtRow:
row
column:
column

Returns the rectangle of the cell at row row and column column

cellSize

Returns the size of the NSMatrix's cells

See Also: -setCellSize:

cellWithTag:
anInt

Returns the cell with tag anInt Returns `nil` if no cell has a tag anInt

cells

Returns an array of the NSMatrix's cells

delegate

Returns the NSMatrix's delegate. delegate is used when editing a cell

See Also: -setDelegate: -textDidEndEditing: -textDidBeginEditing: -textDidChange:

deselectAllCells

Deselects all NSMatrix's cells. Does nothing if the NSMatrix's mode is NSRadioModeMatrix and if it does not allows empty selection. Except for the case, when there are no cells left at all. Then the selection is always cleared.

See Also: -mode -allowsEmptySelection -setNeedsDisplayInRect:

deselectSelectedCell

Deselects the selected cell.Does nothing if the NSMatrix's mode is NSRadioModeMatrix and if it does not allows empty selection

doubleAction

Returns the action method, used when the user double clicks

See Also: -setDoubleAction:

drawCellAtRow:
row
column:
column

Draws the cell at row row and column column

See Also: [NSCell -drawWithFrame:inView:] -setDrawsCellBackground: -drawsCellBackground

drawsBackground

Returns whether the NSMatrix draws its background

See Also: -setDrawsBackground: -drawsCellBackground

drawsCellBackground

Returns whether the NSMatrix draws cells backgrounds

See Also: -setDrawsCellBackground: -drawsBackground

errorAction

Returns the error action method to aSelector This error method is used when in -textShouldEndEditing: if the selected cell doe not have a valid text object

See Also: -setErrorAction:

getNumberOfRows:
rowCount
columns:
columnCount

Gets the number of rows and columns of the NSMatrix

See Also: -numberOfColumns -numberOfRows

getRow:
row
column:
column
forPoint:
aPoint

Gets the row and the column of the NSMatrix correponding to the specified NSPoint aPoint. Returns `YES` if aPoint is within the NSMatrix, `NO` otherwise

getRow:
row
column:
column
ofCell:
aCell

Gets the row and the column of the NSMatrix correponding to the specified NSCell aCell. Returns `YES` if aCell is in the NSMatrix, `NO` otherwise

highlightCell:
flag
atRow:
row
column:
column

(Un)Highlights the cell (if exists) at row at row row and column column. and maks the cell rect for display.

See Also: -setNeedsDisplayInRect: [NSCell -setHighlighted:]

initWithFrame:
frameRect

Initializes and returns a NSMatrix in frame frameRect. By default the matrix has no row and no column, the NSMatrix's mode is NSRadioModeMatrix and the cell class is a NSActionCell class.

See Also: -initWithFrame:mode:cellClass:numberOfRows:numberOfColumns:

initWithFrame:
frameRect
mode:
aMode
cellClass:
classId
numberOfRows:
rowsHigh
numberOfColumns:
colsWide

Initializes and returns a new NSMatrix in the specified frame frameRect. The NSMatrixMode is specified by mode, the cell class used specified by classId and the number of rows and columns specified by rowsHigh and colsWide respectively

See Also: -initWithFrame:mode:prototype:numberOfRows:numberOfColumns:

initWithFrame:
frameRect
mode:
aMode
prototype:
aCell
numberOfRows:
rowsHigh
numberOfColumns:
colsWide

Initializes and returns a new NSMatrix in the specified frame frameRect. The NSMatrixMode is specified by mode, the cell used specified by aCell and the number of rows and columns specified by rowsHigh and colsWide respectively

See Also: -initWithFrame:mode:prototype:numberOfRows:numberOfColumns:

insertColumn:
column

Inserts a new column at the specified column column.

See Also: -insertColumn:withCells:

insertColumn:
column
withCells:
cellArray

Inserts a new column of cells ( specified by cellArray) at the specified column column. This method can grows the matrix as necessay if needed

See Also: -insertColumn:

insertRow:
row

Inserts a new row at index row.

See Also: -insertRow:withCells:

insertRow:
row
withCells:
cellArray

Inserts a new row of cells (specified by cellArray) at the specified row row. This method can grows the matrix as necessay if needed

See Also: -insertColumn:

intercellSpacing

Returns the space size between cells.

See Also: -setIntercellSpacing:

isAutoscroll
Description forthcoming.
isSelectionByRect
Description forthcoming.
keyCell
Description forthcoming.
makeCellAtRow:
row
column:
column

Makes and returns new cell at row row and column column.

mode

Returns the NSMatrix's mode. See NSMatrixMode for more informations. By default the mode is NSRadioModeMatrix .

See Also: -setMode:

mouseDown:
theEvent
Description forthcoming.
mouseDownFlags
Description forthcoming.
nextText

Returns the next key view

See Also: -setNextText: [NSView -nextKeyView]

numberOfColumns

Returns the number of columns of the NSMatrix

See Also: -numberOfRows

numberOfRows

Returns the number of rows of the NSMatrix

See Also: -numberOfColumns

performKeyEquivalent:
theEvent

Simulates a mouse click for the first cell with the corresponding key Equivalent.

See Also: [NSCell -keyEquivalent]

previousText

Returns the previous key view

See Also: -setPreviousText: [NSView -previousKeyView]

prototype

Returns the prototype cell used by the NSMatrix when it creates new cells. The default cell is NSActionCell

See Also: -cellClass -setPrototype: -prototype

putCell:
newCell
atRow:
row
column:
column

Replaces the NSMatrix's cell at row row and column column by newCell and mark for display the new cell. Raises a NSRangeException if the row or column are out of range.

removeColumn:
column

Removes the NSMatrix's column at index column

See Also: -removeRow:

removeRow:
row

Removes the NSMatrix's row at index row

See Also: -removeColumn:

renewRows:
newRows
columns:
newColumns
Description forthcoming.
resetCursorRects
Description forthcoming.
scrollCellToVisibleAtRow:
row
column:
column

Scrolls the NSMatrix to make the cell at row row and column column visible

See Also: -scrollRectToVisible: -cellFrameAtRow:column:

selectAll:
sender

Selects all the cells and marks self for display. Does nothing if the NSMatrix's mode is NSRadioModeMatrix

See Also: -selectCellAtRow:column: -selectCell:

selectCellAtRow:
row
column:
column

Selects the cell and the text inside at row row and column column. If row or column is -1 it deselects all the cells.

See Also: -deselectSelectedCell -selectTextAtRow:column:

selectCellWithTag:
anInt

Selects the cell (and the text inside) with tag anInt. Return `YES` if the NSMatrix contains a cell with tag anInt, `NO` otherwise.

See Also: -deselectSelectedCell -selectTextAtRow:column:

selectText:
sender
Description forthcoming.
selectTextAtRow:
row
column:
column

Select the text of the cell at row row and column column. The cell is selected if and only if the cell is selectable (MacOSX select it if the cell is editable). This methods returns the selected cell if exists and selectable, `nil` otherwise

selectedCell
Description forthcoming.
selectedCells

Returns an array of the selected cells

selectedColumn

Returns the column number of the selected cell or -1 if no cell is selected

See Also: -selectedRow -selectedCell

selectedRow

Returns the row number of the selected cell or -1 if no cell is selected

See Also: -selectedColumn -selectedCell

sendAction

Sends the cell action, if a NSMatrix's cell is selected and enabled, sends the NSMatrix action otherwise. Returns `YES` if the action is succesfully sent. `NO` if a cell is selected but not enabled or if an action can not be sent.

See Also: -sendAction:to: -selectedCell

sendAction:
aSelector
to:
anObject
forAllCells:
flag
Description forthcoming.
sendDoubleAction
Description forthcoming.
setAction:
aSelector
Sets the message to send when a single click occurs.
setAllowsEmptySelection:
flag

Sets a flag to indicate whether the matrix should permit empty selections or should force one or mor cells to be selected at all times.

See Also: -allowsEmptySelection

setAutoscroll:
flag
Description forthcoming.
setAutosizesCells:
flag

Sets whether the NSMatrix resizes its cells automatically

See Also: -autosizesCells

setBackgroundColor:
aColor

Sets the background color to aColor and marks self for display. The background color is used to display the NSMatrix color (the space between the cells), not the cells (uses -setCellBackgroundColor: for that)

See Also: -backgroundColor -setCellBackgroundColor: -cellBackgroundColor -drawsBackground -setDrawsBackground:

setCellBackgroundColor:
aColor

Sets the background color of the NSMatrix's cells to aColor and marks self for display.

See Also: -cellBackgroundColor -backgroundColor -setBackgroundColor: -setDrawsCellBackground: -drawsCellBackground

setCellClass:
classId

Sets the cell class used by the NSMatrix when it creates new cells to classId. The default cell class is a NSActionCell class

See Also: -cellClass -setPrototype: -prototype

setCellSize:
aSize
Description forthcoming.
setDelegate:
anObject

Sets the delegate to anObject. The delegate is used when editing a cell

See Also: -delegate -textDidEndEditing: -textDidBeginEditing: -textDidChange:

setDoubleAction:
aSelector

Sets the message to send when a double click occurs. NB: In GNUstep the following method does *not* set ignoresMultiClick to `NO` as in the MacOS-X spec. It simply sets the doubleAction, as in OpenStep spec.

-doubleAction

setDrawsBackground:
flag

Sets whether the NSMatrix draws its background and marks self for display.

See Also: -drawsBackground -setDrawsCellBackground:

setDrawsCellBackground:
flag

Sets whether the NSMatrix draws cells backgrounds and marks self for display

See Also: -drawsCellBackground -setDrawsBackground:

setErrorAction:
aSelector

Sets the error action method to aSelector . This error method is used when in -textShouldEndEditing: if the selected cell doe not have a valid text object

See Also: -errorAction

setIntercellSpacing:
aSize

Sets the space size between cells to aSize and resizes the matrix to fits the new cells spacing.

See Also: -intercellSpacing -sizeToCells

setKeyCell:
aCell
Description forthcoming.
setMode:
aMode

Sets the NSMatrix's mode to aMode. See NSMatrixMode for more informations. By default the mode is NSRadioModeMatrix .

See Also: -setMode:

setNextText:
anObject

Sets the next key view to anObject

See Also: -nextText [NSView-setNextKeyView:

setPreviousText:
anObject

Sets the previous key view to anObject

See Also: -previousText [NSView-setPreviousKeyView:

setPrototype:
aCell

Sets the prototype cell used by the NSMatrix when it creates new cells to aCell. The default cell is NSActionCell

See Also: -cellClass -setPrototype: -prototype

setScrollable:
flag
Description forthcoming.
setSelectionByRect:
flag
Description forthcoming.
setSelectionFrom:
startPos
to:
endPos
anchor:
anchorPos
highlight:
flag
Description forthcoming.
setState:
value
atRow:
row
column:
column

Sets the state of the cell at row row and column to value. If the NSMatrix's mode is NSRadioModeMatrix it deselects the cell currently selected if needed.

setTabKeyTraversesCells:
flag
Description forthcoming.
setToolTip:
toolTipString
forCell:
cell
Description forthcoming.
setValidateSize:
flag
Description forthcoming.
sizeToCells
Description forthcoming.
sortUsingFunction:
comparator
context:
context
Description forthcoming.
sortUsingSelector:
comparator
Description forthcoming.
tabKeyTraversesCells
Description forthcoming.
textDidBeginEditing:
aNotification

Invokes when the text cell starts to be editing.This methods posts a NSControlTextDidBeginEditingNotification with a dictionary containing the NSFieldEditor as user info

See Also: [NSNotificationCenter -postNotificationName:object:userInfo:]

textDidChange:
aNotification

Invokes when the text cell is changed. This methods posts a NSControlTextDidChangeNotification with a dictionary containing the NSFieldEditor as user info

See Also: [NSNotificationCenter -postNotificationName:object:userInfo:]

textDidEndEditing:
aNotification

Invokes when the text cell is changed. This methods posts a NSControlTextDidEndEditingNotification a dictionary containing the NSFieldEditor as user info

See Also: [NSNotificationCenter -postNotificationName:object:userInfo:]

textShouldBeginEditing:
aTextObject

Asks to the delegate (if it implements -control:textShouldBeginEditing:) if the text should be edit. Returns `YES` if the delegate does not implement this method

textShouldEndEditing:
aTextObject
Description forthcoming.
toolTipForCell:
cell
Description forthcoming.
Software documentation for the NSMatrixDelegate protocol
AppKit/NSMatrix.h
NSControlTextEditingDelegate
Description forthcoming.