Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSTableViewMBS class.

NSTableViewMBS.beginUpdates

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 17.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Begins a group of updates for the table view.

For NSView-based table views, multiple row changes—that is, insertions, deletions, and moves—are animated simultaneously by surrounding calls to those method calls with beginUpdates and endUpdates. These methods are nestable.
The selected rows are maintained during the series of insertions, deletions, moves, and scrolling. If a selected row is deleted, a selection changed notification occurs after removeRowsAtIndexes is called.
It is not necessary to call beginUpdates and endUpdates if only one insertion, deletion, or move is occurring and the table view is an NSView-based table view. When using an NSCell-based table view, you must surround any insertion, deletion, or move in an update block for animations to occur.
The main reason for doing a batch update of changes to a table view is to avoid having the table animate unnecessarily.
Note that these methods should be called to reflect changes in your model; they do not make any underlying model changes.

For NSCell-based table views, it is required to call beginUpdates if you want to animate the insertRowsAtIndexes, removeRowsAtIndexes, and moveRowAtIndex.

Some examples using this method:

NSTableViewMBS.canDragRowsWithIndexes(rowIndexes as NSIndexSetMBS, mouseDownPoint as NSPointMBS) as Boolean

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 Boolean value indicating whether the table view allows dragging the rows at with the drag initiated at the specified point.

rowIndexes: The row indexes to drag.
mouseDownPoint: The location where the drag was initiated.

Returns no to disallow the drag.

NSTableViewMBS.columnAtPoint(p as NSPointMBS) 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 column a given point lies in.

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

See also:

NSTableViewMBS.columnAtPoint(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 column a given point lies in.

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

See also:

NSTableViewMBS.columnForView(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 column index for the specified view.

view: The view for which to retrieve the column.

Returns the index of the column containing view in the tableColumns array. 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 of 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.columnIndexesInRect(rect as NSRectMBS) as NSIndexSetMBS

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 indexes of the receiver's columns that intersect the specified rectangle.

Available in Mac OS X v10.5 and later.

NSTableViewMBS.columnWithIdentifier(identifier as string) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 9.6 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the index of the first column in the receiver whose identifier is equal to a given identifier.

Returns the index of the first column in the receiver whose identifier is equal to anObject (when compared using isEqual:) or –1 if no columns are found with the specified identifier.

Some examples using this method:

NSTableViewMBS.Constructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 8.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Creates a new table view with size 100/100 and position 0/0
Example
Var t as new NSTableViewMBS

On success the handle property is not zero.

See also:

NSTableViewMBS.Constructor(Handle as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 10.3 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Creates an object based on the given NSTableView handle.
Example
Var t as new NSTableViewMBS(0, 0, 100, 100)
Var v as new NSTableViewMBS(t.handle)

MsgBox str(v.Bounds.Width)+" x "+str(v.Bounds.Height)

The handle is casted to a NSTableView and the plugin retains this handle.

See also:

NSTableViewMBS.Constructor(left as Double, top as Double, width as Double, height as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 8.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Creates a new table view with the given size and position.
Example
Var x as new NSTableViewMBS(0, 0, 100, 100)

On success the handle property is not zero.

See also:

NSTableViewMBS.deselectAll

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 8.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Deselects all selected rows or columns if empty selection is allowed; otherwise does nothing.

NSTableViewMBS.deselectColumn(column as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 8.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Deselects the column at a given index if it's selected.

Column is from 0 to numberOfColumns-1.

NSTableViewMBS.deselectRow(row as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 8.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Deselects the row at a given index if it's selected.

Deselects the row at rowIndex if it's selected, regardless of whether empty selection is allowed.

NSTableViewMBS.Destructor

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 9.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The destructor.

Xojo calls this destructor automatically.

NSTableViewMBS.dragImageForRowsWithIndexes(dragRows as NSIndexSetMBS, tableColumns() as NSTableColumnMBS, theEvent as NSEventMBS, byref dragImageOffset as NSPointMBS) as NSImageMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 17.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Computes and returns an image to use for dragging.

dragRows: An index set containing the row indexes that should be in the image.
tableColumns: An array of table columns that should be in the image.
dragEvent: The event that initiated the drag.
dragImageOffset: An in/out parameter specifying the offset of the cursor in the image, the default value is NSZeroPoint. Returning NSZeroPoint causes the cursor to be centered.

Returns an NSImage containing a custom image for the specified rows and columns participating in the drag.

NSTableViewMBS.edit(column as Integer, row as Integer, selectit as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 8.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Edits the cell at columnIndex and rowIndex, selecting its entire contents if flag is true.

This method is invoked automatically in response to user actions; you should rarely need to invoke it directly.

This method scrolls the receiver so that the cell is visible, sets up the field editor, and sends selectWithFrame() and editWithFrame() to the field editor's NSCell object with the NSTableView as the text delegate.

The row at rowIndex must be selected prior to calling editColumn:row:withEvent:select:, or an exception will be raised.

NSTableViewMBS.endUpdates

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 17.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Ends the group of updates for the table view.

Ends the group of updates for the table view. This method, like beginUpdates, is nestable. See beginUpdates for details.

Some examples using this method:

NSTableViewMBS.frameOfCellAtColumnRow(column as Integer, row as Integer) as NSRectMBS

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 rectangle locating the cell that lies at the intersection of the specified column and row.

column: The index in the tableColumns array of the column containing the cell whose rectangle you want.
row: The index of the row containing the cell whose rectangle you want.

Returns a rectangle locating the cell that lies at the intersection of columnIndex and rowIndex. This method returns NSRectMBS.Zero if columnIndex or rowIndex is greater than the number of columns or rows in the table view.

You can use this method to update a single cell more efficiently than sending the table view a reloadData message using reloadData function.
The result of this method is used in a drawWithFrame:inView: message to the table column's data cell. You can subclass and override this method to customize the frame of a particular cell. However, never return a frame larger than the default implementation returns.
The default frame is computed to have a height equal to the rectOfRow: for rowIndex, minus the half intercellSpacing height on the top and half on the bottom. The width of frame is equal to the with of the table column minus half the intercellSpacing width on the left, and half on the right.

Some examples using this method:

NSTableViewMBS.hiddenRowIndexes 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
The indexes of all hidden table rows.

The value of this property is an index set containing the indexes of any hidden table rows. Table rows may be hidden by invoking the hideRowsAtIndexes method. Some drag-and-drop operations also result in hidden rows.

NSTableViewMBS.hideRowsAtIndexes(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
Hides the specified table rows.

indexes: An index set containing indexes of the rows to be hidden.
rowAnimation: An animation effect to be applied when the rows are hidden.

Use this method when you no longer want the data to be visible to the user, but you don’t want to permanently remove the data. Hidden table rows have a height of zero and cannot be selected by the user. However, if a selected table row is hidden, it will remain selected.
Hiding a table row causes the didRemoveRowView delegate method to be invoked.

NSTableViewMBS.indicatorImageInTableColumn(column as NSTableColumnMBS) as NSImageMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa Controls MBS MacControls Plugin 9.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The indicator image of a given table column.

An indicator image is an arbitrary (small) image that is rendered on the right side of the column header. An example of its use is in Mail to indicate the sorting direction of the currently sorted column in a mailbox.
(Read and Write computed property)

NSTableViewMBS.insertRowsAtIndexes(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
Inserts the rows using the specified animation.

indexes: The final positions of the new rows to be inserted.
animationOptions: The animation displayed during the insert. See NSTableViewAnimationOptions for the possible values that can be combined using the bitwise OR operator.

The numberOfRows in the table view is automatically increased by the count of indexes.
Calling this method multiple times within the same beginUpdates and endUpdates block is allowed, and changes are processed incrementally.

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

NSTableViewMBS.isColumnSelected(column as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 8.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns a Boolean value that indicates whether the column at a given index is selected.

column is from 0 to to numberOfColumns.

NSTableViewMBS.isRowSelected(row as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 8.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns a Boolean value that indicates whether the row at a given index is selected.

row is from 0 to to numberOfRows.

NSTableViewMBS.moveRowAtIndex(oldIndex as Integer, newIndex 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
Moves the specified row to the new row location using animation.

oldIndex: Initial row index.
newIndex: New row index.

This is similar to removing a row at oldIndex and inserting it at newIndex, except the same view is used and simply has its position updated to the new location.
Changes happen incrementally as they are sent to the table, so as soon as this method is called the row can be considered moved. However the underlying view is not moved until endUpdates has been called.
This method can be called multiple times within the same beginUpdates and endUpdates block.

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

NSTableViewMBS.noteHeightOfRowsWithIndexesChanged(indexSet as NSIndexSetMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 16.0 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Informs the table view that the rows specified in indexSet have changed height.

indexSet: Index set of rows that have changed their height.

If you implement heightOfRow event this method immediately retiles the table view using the row heights the event provides.

For NSView-based tables, this method will animate. To turn off the animation, create an NSAnimationContext grouping and set the duration to 0. Then call this method and end the grouping.

For NSCell-based tables, this method normally doesn't animate. However, it will animate if you call it inside a beginUpdates/endUpdates block.

NSTableViewMBS.noteNumberOfRowsChanged

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 8.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Informs the receiver that the number of records in its data source has changed.

This method allows the receiver to update the scrollers in its scroll view without actually reloading data into the receiver. It's useful for a data source that continually receives data in the background over a period of time, in which case the table view can remain responsive to the user while the data is received.

NSTableViewMBS.tableColumns as NSTableColumnMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 9.6 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns an array containing the the NSTableColumn objects in the receiver.

The array returned by tableColumns contains all receiver's columns, including those that are hidden.

Some examples using this method:

NSTableViewMBS.tableColumnWithIdentifier(identifier as string) as NSTableColumnMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 9.6 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the NSTableColumn object for the first column whose identifier is equal to a given object.

Returns the NSTableColumn object for the first column whose identifier is equal to anObject, as compared using isEqual:, or nil if no columns are found with the specified identifier.

NSTableViewMBS.tile

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa Controls MBS MacControls Plugin 8.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Properly sizes the receiver and its header view and marks it as needing display.

Also resets cursor rectangles for the header view and line scroll amounts for the NSScrollView object.

NSTableViewMBS.unhideRowsAtIndexes(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
Unhides the specified table rows.

indexes: An index set containing indexes of the hidden rows to be shown again.
rowAnimation: An animation effect to be applied when the rows are hidden.

Unhiding a table row causes the didAddRowView event to be invoked.

NSTableViewMBS.viewAtColumn(column as Integer, 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 view at the specified row and column indexes, creating one if necessary.

column: The index of the column in the tableColumns array.
row: The row index.
makeIfNecessary: true if a view is required, false if you want to update properties on a view, if one is available.

Returns an instance of NSView.

This method first attempts to return an available view, which is generally in the visible area. If there is no available view, and makeIfNecessary is true, a prepared temporary view is returned. If makeIfNecessary is false, and the view is not available, nil will be returned.
In general, makeIfNecessary should be true if you require a resulting view, and false if you only want to update properties on a view only if it is available (generally this means it is visible).
An exception will be thrown if row is not within the numberOfRows. The returned result should generally not be held onto for longer than the current run loop cycle. Instead they should re-query the table view for the row view.

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


The biggest plugin in space...