Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSViewMBS class.

Previous items

NSViewMBS.RenderImage(subviews as boolean = false, flipped as boolean = false) as variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 8.5 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Renders a picture of the view.
Example
Var n as new NSProgressIndicatorMBS
n.sizeToFit

Var image as NSImageMBS = n.RenderImage
Var pic as Picture = image.CopyPicture

Backdrop = pic

May return nil on any error.
The value of this variant must be an object of class NSImageMBS.

Added flipped parameter for version 20.3.
Flipped was true for older versions.

Some examples using this method:

NSViewMBS.replaceSubview(oldView as NSViewMBS, newView as NSViewMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 12.0 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Replaces one of the receiver's subviews with another view.

oldView: The view to be replaced by newView. May not be nil.
newView: The view to replace oldView. May not be nil.

This method does nothing if oldView is not a subview of the receiver.
Neither oldView nor newView may be nil, and the behavior is undefined if either of these parameters is nil.

NSViewMBS.rotateByAngle(angle as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 13.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Rotates the receiver's bounds rectangle by a specified degree value around the origin of the coordinate system, (0.0, 0.0).

angle: A float value specifying the angle of rotation, in degrees.

See the BoundsRotation property description for more information. This method neither redisplays the receiver nor marks it as needing display. You must do this yourself with display or NeedsDisplay.

This method posts an NSViewBoundsDidChangeNotification to the default notification center if the receiver is configured to do so.

NSViewMBS.scaleUnitSquareToSize(size as NSSizeMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.0 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Scales the receiver's coordinate system so that the unit square scales to the specified dimensions.

For example, a newUnitSize of (0.5, 1.0) causes the receiver's horizontal coordinates to be halved, in turn doubling the width of its bounds rectangle. Note that scaling is performed from the origin of the coordinate system, (0.0, 0.0), not the origin of the bounds rectangle; as a result, both the origin and size of the bounds rectangle are changed. The frame rectangle remains unchanged.

This method neither redisplays the receiver nor marks it as needing display. You must do this yourself with display or setNeedsDisplay.

This method posts an NSViewBoundsDidChangeNotification to the default notification center if the receiver is configured to do so.

Some examples using this method:

NSViewMBS.Screenshot as Picture

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 22.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Renders the view into a picture.

Like ScreenshotWindowMBS, but only for the view you are interested in, e.g. a map.
Returns nil on failure like out of memory.

NSViewMBS.scrollPoint(x as double, y as double)   New in 24.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 24.5 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Scrolls the view’s closest ancestor NSClipView object so a point in the view lies at the origin of the clip view's bounds rectangle.

x/y: The point in the view to scroll to.

NSViewMBS.scrollRectToVisible(rect as NSRectMBS) as Boolean   New in 24.5

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 24.5 ✅ Yes ❌ No ❌ No ❌ No Desktop, Console & Web
Scrolls the view’s closest ancestor NSClipView object the minimum distance needed so a specified region of the view becomes visible in the clip view.

The rectangle to be made visible in the clip view.
Returns true if any scrolling is performed; otherwise returns false.

NSViewMBS.setBackgroundFilters(Filters() as variant)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 18.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Sets an array of Core Image filters to apply to the view’s background.

This property contains an array of CIFilterMBS objects. This array represents the background filters stored in the backgroundFilters property of the view’s layer. If the view does not have a layer, setting the value of this property has no effect.
The default value of this property is an empty array.

We use variant here to reduce plugin dependencies. Please use with array of variants containing CIFilterMBS.

NSViewMBS.setBoundsOrigin(origin as NSPointMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Sets the bounds origin.

See also:

NSViewMBS.setBoundsOrigin(x as Double, y as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 7.7 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Sets the bounds origin.

See also:

NSViewMBS.setBoundsSize(size as NSSizeMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Sets the bounds size of the nsview.

See also:

NSViewMBS.setBoundsSize(width as Double, height as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 7.7 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Sets the bounds size of the nsview.

See also:

NSViewMBS.setContentFilters(Filters() as variant)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 18.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Sets an array of Core Image filters to apply to the contents of the view and its sublayers.

This property contains an array of CIFilterMBS objects. This array represents the filters stored in the filters property of the view’s layer. If the view does not have a layer, setting the value of this property has no effect.
The default value of this property is an empty array.

We use variant here to reduce plugin dependencies. Please use with array of variants containing CIFilterMBS.

NSViewMBS.setFocus

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 13.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Convenience function to set the focus to this view.

Calls internally makeFirstResponder on NSWindow.

NSViewMBS.setFrameOrigin(origin as NSPointMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Sets the frame origin.

See also:

NSViewMBS.setFrameOrigin(x as Double, y as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 7.7 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Sets the frame origin.

See also:

NSViewMBS.setFrameSize(size as NSSizeMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Sets the frame size.

See also:

NSViewMBS.setFrameSize(width as Double, height as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 7.7 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Sets the frame size.

See also:

NSViewMBS.subviews(recursive as boolean = false) as NSViewMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
The immediate subviews.

The order of the subviews may be considered as being back-to-front, but this does not imply invalidation and drawing behavior. The order is based on the order of the receiver's subviews as specified in the nib file from which they were unarchived or the programmatic interface for modifying the receiver's subview list. This ordering is also the reverse of the order in which hit-testing is done.

If recursive is true, we include all subviews of all subviews. (new in 14.2)

Some examples using this method:

NSViewMBS.unregisterDraggedTypes

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Unregisters the receiver as a possible destination in a dragging session.

Previous items

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


The biggest plugin in space...