Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSTableViewMBS class.

NSTableViewMBS.rectOfColumn(column as Integer) as NSRectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 9.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the rectangle containing the column at at a given index.

The rectangle containing the column at columnIndex. Returns NSRectMBS.Zero (an empty rectangle) if columnIndex lies outside the range of valid column indices for the receiver.

You can use this method to update a single column more efficiently than sending the table view a reloadData message.

aTableView.setNeedsDisplayInRect(aTableView.rectOfColumn(column))

NSTableViewMBS.rectOfRow(row as Integer) as NSRectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 9.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the rectangle containing the row at a given index.

Returns the rectangle containing the row at rowIndex. Returns NSRectMBS.Zero (an empty rectangle) if rowIndex lies outside the range of valid row indices for the receiver.

NSTableViewMBS.reloadData

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 8.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Marks the receiver as needing redisplay, so it will reload the data for visible cells and draw the new values.

This method forces redraw of all the visible cells in the receiver. If you want to update the value in a single cell, column, or row, it is more efficient to use frameOfCellAtColumn(), rectOfColumn(), or rectOfRow() in conjunction with setNeedsDisplayInRect(). If you just want to update the scroller, use noteNumberOfRowsChanged; if the height of a set of rows changes, use noteHeightOfRowsWithIndexesChanged().

See also:

NSTableViewMBS.reloadData(rowIndexes as NSIndexSetMBS, columnIndexes as NSIndexSetMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 17.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Reloads the data for only the specified rows and columns.

rowIndexes: The indexes of the rows to update.
columnIndexes: The indexes of the columns to update.

For cells that are visible, the appropriate dataSource and delegate methods are called and the cells are redrawn.
For tables that support variable row heights, the row height is not re-queried from the delegate; it is your responsibility to invoke noteHeightOfRowsWithIndexesChanged if a row height change is required.

For NSView-based table views, this method drops the view-cells in the table row, but not the NSTableRowView instances.

See also:

NSTableViewMBS.removeRowsAtIndexes(indexes as NSIndexSetMBS, animationOptions as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 17.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Removes the rows using the specified animation.

indexes: An index set containing the rows to remove.
animationOptions: The animation displayed during the insert. See NSTableViewAnimationOptions for the possible values that can be combined using the bitwise OR operator.

This method deletes from the table the rows represented at indexes and automatically decreases numberOfRows by the count of indexes.
The row indexes should be with respect to the current state displayed in the table view, and not the final state, because the specified rows do not exist in the final state.
Calling this method multiple times within the same beginUpdates and endUpdates block is allowed, and changes are processed incrementally.
Changes are processed incrementally as the insertRowsAtIndexes, removeRowsAtIndexes, and the moveRowAtIndex methods are called. It is acceptable to delete row 0 multiple times, as long as there is still a row available.

NSCell-based table views must first call beginUpdates before calling this method.

NSTableViewMBS.rowAtPoint(x as Double, y as Double) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 9.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the index of the row a given point lies in.

Returns the index of the row aPoint lies in, or –1 if aPoint lies outside the receiver's bounds.

See also:

NSTableViewMBS.rowForView(view as NSViewMBS) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 17.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the index of the row for the specified view.

view: The view for which to retrieve the row.

Returns the index of the row containing to view. This method returns -1 if the view is not in the table view. This method may also return -1 if the row containing the view is being animated away, such as during the deletion of a row.

This method is typically called in the action method for an NSButton (or NSControl) to find out what row (and column) the action should be performed on.
The implementation is O(n) where n is the number of visible rows, so this method should generally not be called within a loop.

NSTableViewMBS.rowsInRect(rect as NSRectMBS) as NSRangeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 17.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns a range of indexes for the rows that lie wholly or partially within the vertical boundaries of the specified rectangle.

Rect: A rectangle in the coordinate system of the table view.

Returns a range of indexes for the table view’s rows that lie wholly or partially within the horizontal boundaries of aRect. If the width or height of aRect is 0, this method returns an NSRange whose length is 0.

The location of the range is the index of the first row in the rectangle, and the length is the number of rows that lie in the rectangle.

NSTableViewMBS.rowViewAtRow(row as Integer, makeIfNecessary as Boolean) as NSViewMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 17.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns a row view at the specified index, creating one if necessary.

row: The row index.
makeIfNecessary: True if a view is required, NO if you want to update properties on a view, if one is available.

Returns an instance, or subclass, of NSTableRowView. Returning nil is also valid if makeIfNecessary is false and the view did not exist.

This method first attempts to return a currently displayed view in the visible area. If there is no visible view, and makeIfNecessary is true, a prepared temporary view is returned. If makeIfNecessary is false, and the view is not visible, nil is returned.
In general, makeIfNecessary should be true if you require a resulting view, and false if you want to update properties on a view only if it is available (generally this means it is visible).
An exception is thrown if row falls outside of the number of rows in the table (numberOfRows). The returned result should generally not be held onto for longer than the current run loop cycle. It’s better to call rowViewAtRow whenever a view is required.

The items on this page are in the following plugins: MBS MacControls Plugin.


The biggest plugin in space...