Platforms to show: All Mac Windows Linux Cross-Platform
NSCollectionViewMBS class
Super class: NSViewMBS
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Cocoa Collection View | MBS MacControls Plugin | 21.0 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
The simplest type of collection view displays its items in a grid, but you can define layouts to arrange items however you like. For example, you might create a layout where items are arranged in a circle. You can also change layouts dynamically at runtime whenever you need to present items differently.
See also:
https://developer.apple.com/documentation/appkit/views_and_controls/collection_view
https://developer.apple.com/documentation/appkit/nscollectionview
Subclass of the NSViewMBS class.
- 9 properties
- property allowsEmptySelection as Boolean
- property allowsMultipleSelection as Boolean
- property animator as NSCollectionViewMBS
- property backgroundView as NSViewMBS
- property backgroundViewScrollsWithContent as Boolean
- property collectionViewLayout as NSCollectionViewLayoutMBS
- property firstResponder as Boolean
- property numberOfSections as Integer
- property selectable as Boolean
- 39 methods
- method backgroundColors as NSColorMBS()
- method Constructor
- method Constructor(Handle as Integer)
- method Constructor(left as double, top as double, width as double, height as double)
- method deleteItems(indexPaths() as NSIndexPathMBS)
- method deleteSections(sections as NSIndexSetMBS)
- method deselectAll
- method deselectItems(indexPaths() as NSIndexPathMBS)
- method frameForItem(Index as Integer) as NSRectMBS
- method frameForItem(Index as Integer, numberOfItems as Integer) as NSRectMBS
- method indexPathForItem(indexPath as NSCollectionViewItemMBS) as NSIndexPathMBS
- method indexPathForItem(x as double, y as double) as NSIndexPathMBS
- method indexPathsForVisibleItems as NSIndexPathMBS()
- method indexPathsForVisibleSupplementaryElementsOfKind(elementKind as String) as NSIndexPathMBS()
- method insertItems(indexPaths() as NSIndexPathMBS)
- method insertSections(sections as NSIndexSetMBS)
- method item(index as Integer) as NSCollectionViewItemMBS
- method item(indexPath as NSIndexPathMBS) as NSCollectionViewItemMBS
- method layoutAttributesForItem(indexPath as NSIndexPathMBS) as NSCollectionViewLayoutAttributesMBS
- method layoutAttributesForSupplementaryElementOfKind(kind as String, indexPath as NSIndexPathMBS) as NSCollectionViewLayoutAttributesMBS
- method makeItem(indexPath as NSIndexPathMBS) as NSCollectionViewItemMBS
- method makeSupplementaryViewOfKind(elementKind as String, indexPath as NSIndexPathMBS) as NSCollectionViewSectionHeaderViewMBS
- method moveItem(indexPath as NSIndexPathMBS, toIndexPath as NSIndexPathMBS)
- method moveSection(section as Integer, toSection as Integer)
- method numberOfItemsInSection(section as Integer) as Integer
- method reloadData
- method reloadItems(indexPaths() as NSIndexPathMBS)
- method reloadSections(sections as NSIndexSetMBS)
- method scrollToItems(indexPaths() as NSIndexPathMBS, scrollPosition as Integer)
- method selectAll
- method selection as NSIndexPathMBS()
- method selectItems(indexPaths() as NSIndexPathMBS, scrollPosition as Integer)
- method setBackgroundColors(Colors() as NSColorMBS = nil)
- method setDraggingSourceOperationMask(mask as integer, local as boolean)
- method setSelection(indexPaths() as NSIndexPathMBS)
- method supplementaryViewForElementKind(elementKind as String, indexPath as NSIndexPathMBS) as NSCollectionViewSectionHeaderViewMBS
- method toggleSectionCollapse(sender as NSViewMBS)
- method visibleItems as NSCollectionViewItemMBS()
- method visibleSupplementaryViewsOfKind(elementKind as String) as NSViewMBS()
- 11 constants
Scroll Position
Constant | Value | Description |
---|---|---|
NSCollectionViewScrollPositionBottom | 4 | Scroll so that the bottom edge of the bounding box is adjacent to the bottom of the collection view’s bounds. more |
NSCollectionViewScrollPositionCenteredHorizontally | 16 | Scroll so that the selected items’ bounding box is centered horizontally in the collection view’s bounds. more |
NSCollectionViewScrollPositionCenteredVertically | 2 | Scroll so that the bounding box of the selected items is centered vertically in the collection view’s bounds. more |
NSCollectionViewScrollPositionLeadingEdge | 64 | Scroll so that the leading edge of the selected items’ bounding box is adjacent to the leading edge of the collection view’s bounds. more |
NSCollectionViewScrollPositionLeft | 8 | Scroll so that the left edge of the selected items’ bounding box is adjacent to the left edge of the collection view’s bounds. more |
NSCollectionViewScrollPositionNearestHorizontalEdge | 512 | Scroll so that the bounding box is adjacent to the nearest edge (top or bottom) of the collection view. more |
NSCollectionViewScrollPositionNearestVerticalEdge | 256 | Scroll so that the bounding box is adjacent to the nearest edge (leading or trailing) of the collection view. more |
NSCollectionViewScrollPositionNone | 0 |
Do not scroll. |
NSCollectionViewScrollPositionRight | 32 | Scroll so that the right edge of the selected items’ bounding box is adjacent to the right edge of the collection view’s bounds. more |
NSCollectionViewScrollPositionTop | 1 | Scroll so that the top edge of the selected items’ bounding box is adjacent to the top edge of the collection view’s bounds. more |
NSCollectionViewScrollPositionTrailingEdge | 128 | Scroll so that the trailing edge of the selected items’ bounding box is adjacent to the trailing edge of the collection view’s bounds. more |
Super class NSViewMBS
- 43 properties
- property acceptsTouchEvents as boolean
- property allowsVibrancy as Boolean
- property alphaValue as Double
- property autoresizesSubviews as boolean
- property autoresizingMask as Integer
- property bounds as NSRectMBS
- property boundsRotation as Double
- property canBecomeKeyView as boolean
- property canDraw as boolean
- property canDrawConcurrently as boolean
- property className as string
- property classPath as string
- property clipsToBounds as Boolean
- property focusRingType as Integer
- property frame as NSRectMBS
- property frameCenterRotation as Double
- property frameHeight as Double
- property frameLeft as Double
- property frameRotation as Double
- property frameTop as Double
- property frameWidth as Double
- property identifier as string
- property isFlipped as Boolean
- property isHidden as Boolean
- property isHiddenOrHasHiddenAncestor as Boolean
- property isOpaque as Boolean
- property isRotatedFromBase as Boolean
- property isRotatedOrScaledFromBase as Boolean
- property layer as Variant
- property layerUsesCoreImageFilters as Boolean
- property needsDisplay as Boolean
- property nextKeyView as NSViewMBS
- property opaqueAncestor as NSViewMBS
- property RetainCount as Integer
- property superview as NSViewMBS
- property toolTip as string
- property userInteractionEnabled as Boolean
- property visibleRect as NSRectMBS
- property wantsDefaultClipping as boolean
- property wantsLayer as Boolean
- property wantsRestingTouches as boolean
- property window as NSWindowMBS
- property compositingFilter as variant
- 62 methods
- method addSubview(subview as NSViewMBS)
- method addSubview(subview as NSViewMBS, positioned as Integer, relativeToView as NSViewMBS)
- method addToolTipRect(rect as NSRectMBS, tooltip as NSViewTooltipMBS)
- method adjustScroll(rect as NSRectMBS) as NSRectMBS New in 24.5
- method ancestorSharedWithView(view as NSViewMBS) as NSViewMBS
- method animator as NSViewMBS
- method autoscroll(e as NSEventMBS) as Boolean New in 24.5
- method backgroundFilters as variant()
- method beginDraggingSessionWithItems(items() as Variant, e as NSEventMBS, source as NSViewMBS) as Variant
- method Constructor
- method Constructor(Handle as Integer)
- method Constructor(left as Double, top as Double, width as Double, height as Double)
- method contentFilters as variant()
- method convertPointFromView(point as NSPointMBS, View as NSViewMBS) as NSPointMBS
- method convertPointToView(point as NSPointMBS, View as NSViewMBS) as NSPointMBS
- method convertRectFromView(rect as NSRectMBS, View as NSViewMBS) as NSRectMBS
- method convertRectToView(rect as NSRectMBS, View as NSViewMBS) as NSRectMBS
- method convertSizeFromView(Size as NSSizeMBS, View as NSViewMBS) as NSSizeMBS
- method convertSizeToView(Size as NSSizeMBS, View as NSViewMBS) as NSSizeMBS
- method dataWithEPSInsideRect(left as Double, top as Double, width as Double, height as Double) as Memoryblock
- method dataWithPDFInsideRect(left as Double, top as Double, width as Double, height as Double) as Memoryblock
- method dataWithPDFInsideRect(r as NSRectMBS) as Memoryblock
- method dragImage(image as NSImageMBS, viewLocation as NSPointMBS, offset as NSSizeMBS, NSEvent as NSEventMBS, pboard as NSPasteboardMBS, source as NSViewMBS, slideFlag as boolean)
- method drawFocusRingMask
- method enclosingMenuItem as Variant
- method enclosingScrollView as Variant
- method focusRingMaskBounds as NSRectMBS
- method hitTest(x as double, y as double) as NSViewMBS
- method isDescendantOf(view as NSViewMBS) as boolean
- method makeBackingLayer as Variant
- method nextValidKeyView as NSViewMBS
- method noteFocusRingMaskChanged
- method pageFooter as NSAttributedStringMBS
- method pageHeader as NSAttributedStringMBS
- method previousKeyView as NSViewMBS
- method previousValidKeyView as NSViewMBS
- method print
- method registeredDraggedTypes as string()
- method registerForDraggedTypes(Types() as string)
- method removeAllToolTips
- method removeFromSuperview
- method removeFromSuperviewWithoutNeedingDisplay
- method RenderImage(subviews as boolean = false, flipped as boolean = false) as variant
- method replaceSubview(oldView as NSViewMBS, newView as NSViewMBS)
- method rotateByAngle(angle as Double)
- method scaleUnitSquareToSize(size as NSSizeMBS)
- method Screenshot as Picture
- method scrollPoint(x as double, y as double) New in 24.5
- method scrollRectToVisible(rect as NSRectMBS) as Boolean New in 24.5
- method setBackgroundFilters(Filters() as variant)
- method setBoundsOrigin(origin as NSPointMBS)
- method setBoundsOrigin(x as Double, y as Double)
- method setBoundsSize(size as NSSizeMBS)
- method setBoundsSize(width as Double, height as Double)
- method setContentFilters(Filters() as variant)
- method setFocus
- method setFrameOrigin(origin as NSPointMBS)
- method setFrameOrigin(x as Double, y as Double)
- method setFrameSize(size as NSSizeMBS)
- method setFrameSize(width as Double, height as Double)
- method subviews(recursive as boolean = false) as NSViewMBS()
- method unregisterDraggedTypes
- 5 shared methods
- shared method NSViewBoundsDidChangeNotification as string
- shared method NSViewDidUpdateTrackingAreasNotification as string
- shared method NSViewFocusDidChangeNotification as string
- shared method NSViewFrameDidChangeNotification as string
- shared method NSViewGlobalFrameDidChangeNotification as string
- 21 constants
Constants
Constant | Value | Description |
---|---|---|
NSBezelBorder | 2 |
One of the constants to specify the type of a view's border.
A concave border that makes the view look sunken. |
NSFocusRingTypeDefault | 0 |
One of the constants for the focusringtype property.
The default focus ring type for NSView or NSCell. |
NSFocusRingTypeExterior | 2 |
One of the constants for the focusringtype property.
The standard Aqua focus ring. |
NSFocusRingTypeNone | 1 |
One of the constants for the focusringtype property.
No focus ring. If you set the focus ring type to this value, NSView and NSCell will not draw any focus ring. |
NSGrooveBorder | 3 |
One of the constants to specify the type of a view's border.
A thin border that looks etched around the image. |
NSLineBorder | 1 |
One of the constants to specify the type of a view's border.
A black line border around the view. |
NSNoBorder | 0 |
One of the constants to specify the type of a view's border.
No border. |
NSViewHeightSizable | 16 |
One of the constants for the autoresizingMask property.
The receiver's height is flexible. |
NSViewLayerContentsRedrawBeforeViewResize | 3 | One of the view layer content redraw policy constants. |
NSViewLayerContentsRedrawDuringViewResize | 2 | One of the view layer content redraw policy constants. |
NSViewLayerContentsRedrawNever | 0 | One of the view layer content redraw policy constants. |
NSViewLayerContentsRedrawOnSetNeedsDisplay | 1 | One of the view layer content redraw policy constants. |
NSViewMaxXMargin | 4 |
One of the constants for the autoresizingMask property.
The right margin between the receiver and its superview is flexible. |
NSViewMaxYMargin | 32 |
One of the constants for the autoresizingMask property.
The top margin between the receiver and its superview is flexible. |
NSViewMinXMargin | 1 |
One of the constants for the autoresizingMask property.
The left margin between the receiver and its superview is flexible. |
NSViewMinYMargin | 8 |
One of the constants for the autoresizingMask property.
The bottom margin between the receiver and its superview is flexible. |
NSViewNotSizable | 0 |
One of the constants for the autoresizingMask property.
The receiver cannot be resized. |
NSViewWidthSizable | 2 |
One of the constants for the autoresizingMask property.
The receiver's width is flexible. |
Window Order Constants
Constant | Value | Description |
---|---|---|
NSWindowAbove | 1 |
Moves the window above the indicated window. |
NSWindowBelow | -1 |
Moves the window below the indicated window. |
NSWindowOut | 0 |
Moves the window off the screen. |
Super class NSResponderMBS
- 3 properties
- property Handle as Integer
- property menu as NSMenuMBS
- property nextResponder as NSResponderMBS
- 124 methods
- method beginGestureWithEvent(e as NSEventMBS)
- method cancelOperation
- method capitalizeWord
- method centerSelectionInVisibleArea
- method changeCaseOfLetter
- method complete
- method Constructor Private
- method cursorUpdate(e as NSEventMBS)
- method deleteBackward
- method deleteBackwardByDecomposingPreviousCharacter
- method deleteForward
- method deleteToBeginningOfLine
- method deleteToBeginningOfParagraph
- method deleteToEndOfLine
- method deleteToEndOfParagraph
- method deleteToMark
- method deleteWordBackward
- method deleteWordForward
- method endGestureWithEvent(e as NSEventMBS)
- method flagsChanged(e as NSEventMBS)
- method flushBufferedKeyEvents
- method helpRequested(e as NSEventMBS)
- method indent
- method insertBacktab
- method insertContainerBreak
- method insertDoubleQuoteIgnoringSubstitution
- method insertLineBreak
- method insertNewline
- method insertNewlineIgnoringFieldEditor
- method insertParagraphSeparator
- method insertSingleQuoteIgnoringSubstitution
- method insertTab
- method insertTabIgnoringFieldEditor
- method keyDown(e as NSEventMBS)
- method keyUp(e as NSEventMBS)
- method lowercaseWord
- method magnifyWithEvent(e as NSEventMBS)
- method makeBaseWritingDirectionLeftToRight
- method makeBaseWritingDirectionNatural
- method makeBaseWritingDirectionRightToLeft
- method makeTextWritingDirectionLeftToRight
- method makeTextWritingDirectionNatural
- method makeTextWritingDirectionRightToLeft
- method mouseDown(e as NSEventMBS)
- method mouseDragged(e as NSEventMBS)
- method mouseEntered(e as NSEventMBS)
- method mouseExited(e as NSEventMBS)
- method mouseMoved(e as NSEventMBS)
- method mouseUp(e as NSEventMBS)
- method moveBackward
- method moveBackwardAndModifySelection
- method moveDown
- method moveDownAndModifySelection
- method moveForward
- method moveForwardAndModifySelection
- method moveLeft
- method moveLeftAndModifySelection
- method moveParagraphBackwardAndModifySelection
- method moveParagraphForwardAndModifySelection
- method moveRight
- method moveRightAndModifySelection
- method moveToBeginningOfDocument
- method moveToBeginningOfDocumentAndModifySelection
- method moveToBeginningOfLine
- method moveToBeginningOfLineAndModifySelection
- method moveToBeginningOfParagraph
- method moveToBeginningOfParagraphAndModifySelection
- method moveToEndOfDocument
- method moveToEndOfDocumentAndModifySelection
- method moveToEndOfLine
- method moveToEndOfLineAndModifySelection
- method moveToEndOfParagraph
- method moveToEndOfParagraphAndModifySelection
- method moveToLeftEndOfLine
- method moveToLeftEndOfLineAndModifySelection
- method moveToRightEndOfLine
- method moveToRightEndOfLineAndModifySelection
- method moveUp
- method moveUpAndModifySelection
- method moveWordBackward
- method moveWordBackwardAndModifySelection
- method moveWordForward
- method moveWordForwardAndModifySelection
- method moveWordLeft
- method moveWordLeftAndModifySelection
- method moveWordRight
- method moveWordRightAndModifySelection
- method otherMouseDown(e as NSEventMBS)
- method otherMouseDragged(e as NSEventMBS)
- method otherMouseUp(e as NSEventMBS)
- method pageDown
- method pageDownAndModifySelection
- method pageUp
- method pageUpAndModifySelection
- method performMnemonic(theString as string) as boolean
- method presentError(e as NSErrorMBS) as boolean
- method rightMouseDown(e as NSEventMBS)
- method rightMouseDragged(e as NSEventMBS)
- method rightMouseUp(e as NSEventMBS)
- method rotateWithEvent(e as NSEventMBS)
- method scrollLineDown
- method scrollLineUp
- method scrollPageDown
- method scrollPageUp
- method scrollToBeginningOfDocument
- method scrollToEndOfDocument
- method scrollWheel(e as NSEventMBS)
- method selectAll
- method selectLine
- method selectParagraph
- method selectToMark
- method selectWord
- method setMark
- method showContextHelp
- method showWritingTools New in 24.5
- method swapWithMark
- method swipeWithEvent(e as NSEventMBS)
- method tabletPoint(e as NSEventMBS)
- method tabletProximity(e as NSEventMBS)
- method transpose
- method transposeWords
- method undoManager as NSUndoManagerMBS
- method uppercaseWord
- method yank
This class has no sub classes.
Some properties using for this class:
- DesktopNSCollectionViewControlMBS.View as NSCollectionViewMBS
- NSCollectionViewControlMBS.View as NSCollectionViewMBS
- NSCollectionViewItemMBS.collectionView as NSCollectionViewMBS
- NSCollectionViewLayoutMBS.collectionView as NSCollectionViewMBS
- NSCollectionViewMBS.animator as NSCollectionViewMBS
Some examples using this class:
Blog Entries
- MBS Xojo Plugins, version 21.3pr2
- MBS Xojo Plugins, version 21.3pr1
- MBS Xojo Plugins, version 21.1pr3
- MonkeyBread Software Releases the MBS Xojo Plugins in version 21.0
- MBS Xojo Plugins, version 20.6pr2
Release notes
- Version 21.3
- Added setDraggingSourceOperationMask method to NSCollectionViewMBS class.
- Added toggleSectionCollapse method to NSCollectionViewMBS class.
- Changed makeSupplementaryViewOfKind and supplementaryViewForElementKind methods in NSCollectionViewMBS class to use new NSCollectionViewSectionHeaderViewMBS class.
- Fixed makeSupplementaryViewOfKind method in NSCollectionViewMBS class to work better.
- Version 21.1
- Fixed problem with NSCollectionViewMBS raising events while closing and causing crashes.
- Version 21.0
- Added NSCollectionViewMBS and related classes.
The items on this page are in the following plugins: MBS MacBase Plugin, MBS MacControls Plugin.
NSCollectionViewLayoutMBS - NSCollectionViewSectionHeaderViewMBS