Xojo Developer Conference
25/27th April 2018 in Denver.
MBS Xojo Conference
6/7th September 2018 in Munich, Germany.

Platforms to show: All Mac Windows Linux Cross-Platform

Next items

NSViewMBS.addSubview(subview as NSViewMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 8.0 Yes No No Yes, macOS only No
Function: Adds a view to the subviews so it's displayed above its siblings.
Example:
// create a button
dim n as new NSButtonMBS(100, 100, 50, 24)

n.bezelStyle = n.NSRoundedBezelStyle
n.Title = "Test"

// add directly to window's content view
window1.NSWindowMBS.contentView.addSubview n

See also:

Feedback, Comments & Corrections

NSViewMBS.addSubview(subview as NSViewMBS, positioned as Integer, relativeToView as NSViewMBS)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 12.0 Yes No No Yes, macOS only No
Function: Inserts a view among the receiver's subviews so it's displayed immediately above or below another view.
Example:
// create a button
dim n as new NSButtonMBS(100, 100, 50, 24)

n.bezelStyle = n.NSRoundedBezelStyle
n.Title = "Test"

// add directly to window's super view, below the content view
// so it is behind all RB controls
window1.NSWindowMBS.contentView.superview.addSubview n, NSWindowMBS.NSWindowBelow, window1.NSWindowMBS.contentView
Notes:
subView: The view object to add to the receiver as a subview.
positioned: A constant specifying the position of the aView relative to otherView. Valid values are NSWindowAbove or NSWindowBelow.
relativeToView: The other view subView is to be positioned relative to. If relativeToView is nil (or isn't a subview of the receiver), subView is added above or below all of its new siblings.

This method also sets the receiver as the next responder of aView.

See also:

Feedback, Comments & Corrections

NSViewMBS.ancestorSharedWithView(view as NSViewMBS) as NSViewMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 9.6 Yes No No Yes, macOS only No
Function: The closest ancestor shared by the receiver and a given view.
Notes: The closest ancestor or nil if there's no such object. Returns self if aView is identical to the receiver.

Feedback, Comments & Corrections

NSViewMBS.animator as NSViewMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 10.0 Yes No No Yes, macOS only No
Function: Returns the proxy object for this view which animates.
Example:
dim v as NSViewMBS // your NSViewMBS object

v.alphaValue = 0.5 // switch alpha directly
v.animator.alphaValue = 0.5 // switch alpha animated

Feedback, Comments & Corrections

NSViewMBS.beginDraggingSessionWithItems(items() as Variant, e as NSEventMBS, source as NSViewMBS) as Variant
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 13.1 Yes No No Yes, macOS only No
Function: Initiates a dragging session with a group of dragging items.
Notes:
items: The dragging items (array of variant containing NSDraggingItemMBS objects). The frame property of each NSDraggingItem must be in the view's coordinate system.
event: The mouse-down event object from which to initiate the drag operation. In particular, its mouse location is used for the offset of the icon being dragged.
source: An object that serves as the controller of the dragging operation. It must conform to the NSDraggingSource informal protocol and is typically the receiver itself or its NSWindow object.

Returns the dragging session for the drag (NSDraggingSessionMBS object). Returned as Variant to reduce plugin dependencies.

A basic drag starts by calling beginDraggingSessionWithItems.

The caller can take the returned NSDraggingSession and continue to modify its properties such as slidesBackOnCancelOrFail. When the drag actually starts, the source is sent a draggingSessionWillBeginAtPoint message followed by multiple draggingSessionMovedToPoint messages as the user drags.

Once the drag is ended or cancelled, the source receives a draggingSessionEndedAtPoint:operation and the drag is complete.

Available in OS X v10.7 and later.

Feedback, Comments & Corrections

NSViewMBS.Constructor
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 8.2 Yes No No Yes, macOS only No
Function: Creates a new control with size 100/100 and position 0/0
Notes: On success the handle property is not zero.

See also:

Feedback, Comments & Corrections

NSViewMBS.Constructor(Handle as Integer)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 8.6 Yes No No Yes, macOS only No
Function: Creates an object based on the given NSView handle.
Example:
dim t as new NSTextViewMBS(0, 0, 100, 100)
dim v as new NSTextViewMBS(t.handle)

MsgBox str(v.Bounds.Width)+" x "+str(v.Bounds.Height)
Notes: The handle is casted to a NSView and the plugin retains this handle.

See also:

Feedback, Comments & Corrections

NSViewMBS.Constructor(left as Double, top as Double, width as Double, height as Double)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 7.8 Yes No No Yes, macOS only No
Function: The constructor to create a new NSView.
Notes:
On success handle is set.

For a toolbar, please get the view directly: self.NSToolbarMBS.toolbarView.

See also:

Feedback, Comments & Corrections

NSViewMBS.convertPointFromView(point as NSPointMBS, View as NSViewMBS) as NSPointMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 10.3 Yes No No Yes, macOS only No
Function: Converts a point from the coordinate system of a given view to that of the receiver.
Notes:
point: A point specifying a location in the coordinate system of aView.
View: The view with aPoint in its coordinate system. If View is nil, this method instead converts from window base coordinates. Otherwise, both View and the receiver must belong to the same NSWindow object.

Returns the point converted to the coordinate system of the receiver.

Feedback, Comments & Corrections

NSViewMBS.convertPointToView(point as NSPointMBS, View as NSViewMBS) as NSPointMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 10.3 Yes No No Yes, macOS only No
Function: Converts a point from the receiver's coordinate system to that of a given view.
Notes:
point: A point specifying a location in the coordinate system of the receiver.
View: The view into whose coordinate system point is to be converted. If View is nil, this method instead converts to window base coordinates. Otherwise, both View and the receiver must belong to the same NSWindow object.

Returns the point converted to the coordinate system of View.

Feedback, Comments & Corrections

NSViewMBS.convertRectFromView(rect as NSRectMBS, View as NSViewMBS) as NSRectMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 10.3 Yes No No Yes, macOS only No
Function: Converts a rectangle from the coordinate system of another view to that of the receiver.
Notes:
rect: The rectangle in aView's coordinate system.
view: The view with aRect in its coordinate system. If view is nil, this method instead converts from window base coordinates. Otherwise, both view and the receiver must belong to the same NSWindow object.

Returns the converted rectangle.

Feedback, Comments & Corrections

NSViewMBS.convertRectToView(rect as NSRectMBS, View as NSViewMBS) as NSRectMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 10.3 Yes No No Yes, macOS only No
Function: Converts a rectangle from the receiver's coordinate system to that of another view.
Notes:
rect: A rectangle in the receiver's coordinate system.
View: The view that is the target of the conversion operation. If View is nil, this method instead converts from window base coordinates. Otherwise, both View and the receiver must belong to the same NSWindow object.

Returns the converted rectangle.

Feedback, Comments & Corrections

NSViewMBS.convertSizeFromView(Size as NSSizeMBS, View as NSViewMBS) as NSSizeMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 10.3 Yes No No Yes, macOS only No
Function: Converts a size from another view's coordinate system to that of the receiver.
Notes:
Size: The size (width and height) in aView's coordinate system.
View: The view with Size in its coordinate system. If View is nil, this method instead converts from window base coordinates. Otherwise, both View and the receiver must belong to the same NSWindow object.

Returns the converted size, as an NSSize structure.

Feedback, Comments & Corrections

NSViewMBS.convertSizeToView(Size as NSSizeMBS, View as NSViewMBS) as NSSizeMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 10.3 Yes No No Yes, macOS only No
Function: Converts a size from the receiver's coordinate system to that of another view.
Notes:
Size: The size (width and height) in the receiver's coordinate system.
View: The view that is the target of the conversion operation. If View is nil, this method instead converts from window base coordinates. Otherwise, both View and the receiver must belong to the same NSWindow object.

Returns the converted size, as an NSSize structure.

Feedback, Comments & Corrections

NSViewMBS.dataWithEPSInsideRect(left as Double, top as Double, width as Double, height as Double) as Memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 8.5 Yes No No Yes, macOS only No
Function: Returns EPS data that draws the region of the receiver within a specified rectangle.
Example:
dim n as new NSProgressIndicatorMBS
n.sizeToFit

dim data as string = n.dataWithEPSInsideRect(0, 0, n.frameWidth, n.frameHeight)
dim f as FolderItem = SpecialFolder.Desktop.Child("test.ps")
dim b as BinaryStream = f.CreateBinaryFile("")

b.Write data
f.Launch

Feedback, Comments & Corrections

NSViewMBS.dataWithPDFInsideRect(left as Double, top as Double, width as Double, height as Double) as Memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 8.5 Yes No No Yes, macOS only No
Function: Returns PDF data that draws the region of the receiver within a specified rectangle.
Example:
dim n as new NSProgressIndicatorMBS
n.sizeToFit

dim data as string = n.dataWithPDFInsideRect(0, 0, n.frameWidth, n.frameHeight)
dim f as FolderItem = SpecialFolder.Desktop.Child("test.pdf")
dim b as BinaryStream = f.CreateBinaryFile("")

b.Write data
f.Launch

See also:

Feedback, Comments & Corrections

NSViewMBS.dataWithPDFInsideRect(r as NSRectMBS) as Memoryblock
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 14.2 Yes No No Yes, macOS only No
Function: Returns PDF data that draws the region of the receiver within a specified rectangle.

See also:

Feedback, Comments & Corrections

NSViewMBS.dragImage(image as NSImageMBS, viewLocation as NSPointMBS, offset as NSSizeMBS, NSEvent as NSEventMBS, pboard as NSPasteboardMBS, source as NSViewMBS, slideFlag as boolean)
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 13.5 Yes No No Yes, macOS only No
Function: Initiates a dragging operation from the receiver, allowing the user to drag arbitrary data with a specified icon into any application that has window or view objects that accept dragged data.
Notes:
Image: The NSImage object to be dragged.
viewLocation: The location of the image's lower-left corner, in the receiver's coordinate system. It determines the placement of the dragged image under the cursor. When determining the image location you should use the mouse down coordinate, provided in theEvent, rather than the current mouse location.
offset: This parameter is ignored.
NSEvent: The left mouse-down event that triggered the dragging operation (see discussion below).
pboard: The pasteboard that holds the data to be transferred to the destination (see discussion below).
source: An object that serves as the controller of the dragging operation. It must conform to the NSDraggingSource protocol and is typically the receiver itself or its NSWindow object.
slideBack: A Boolean that determines whether the drag image should slide back if it's rejected. The image slides back to imageLoc if slideBack is true and the image isn't accepted by the dragging destination. If false the image doesn't slide back.

This method must be invoked only within an implementation of the mouseDown or mouseDragged methods.
Before invoking this method, you must place the data to be transferred on pboard. To do this, get the drag pasteboard object (NSDragPboard), declare the types of the data, and then put the data on the pasteboard.

Feedback, Comments & Corrections

NSViewMBS.drawFocusRingMask
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 12.3 Yes No No Yes, macOS only No
Function: Draws the focus ring mask for the view.
Notes:
This method provides the shape of the focus ring mask by drawing the focus ring mask. An implementation of this method should draw in the view's interior (bounds) coordinate space, that the focus ring style has been set (it will be set it to NSFocusRingOnly to capture the focus ring itself), and that the fill and stroke colors have been set to an arbitrary fully opaque color.

Subclasses that find the default behavior insufficient should only draw the focus ring shape.

The NSView implementation of this method simply fills self.bounds.
Available in Mac OS X v10.7 and later.

Feedback, Comments & Corrections

NSViewMBS.enclosingMenuItem as Variant
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 11.2 Yes No No Yes, macOS only No
Function: Returns the menu item containing the receiver or any of its superviews in the view hierarchy.
Notes:
Returns the menu item containing the receiver or any of its superviews in the view hierarchy, or nil if the receiver's view hierarchy is not in a menu item

Available in Mac OS X v10.5 and later.

Declared as a variant to reduce plugin dependencies.
Please assign to a NSScrollViewMBS variable.

Feedback, Comments & Corrections

NSViewMBS.enclosingScrollView as Variant
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 11.1 Yes No No Yes, macOS only No
Function: Returns the nearest ancestor NSScrollView object containing the receiver (not including the receiver itself); otherwise returns nil.
Notes:
Declared as a variant to reduce plugin dependencies.
Please assign to a NSScrollViewMBS variable.

Feedback, Comments & Corrections

NSViewMBS.focusRingMaskBounds as NSRectMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 12.3 Yes No No Yes, macOS only No
Function: Returns the focus ring mask bounds.
Notes:
Returns a rectangle containing the mask in the view's interior (bounds) coordinate space.

The mask bounds allows the focus ring's overall size and position to be determined before it is drawn.
Subclasses must override this method if they require the display of a focus ring.
The NSView implementation of this method simply returns NSRectMBS.Zero.

Note: The information provided by focusRingMaskBounds will enable Accessibility to identify selected subelements for zoom tracking, so it is important that this method provide a reasonably tight bounding box and that noteFocusRingMaskChanged is invoked as described.

Feedback, Comments & Corrections

NSViewMBS.isDescendantOf(view as NSViewMBS) as boolean
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 7.7 Yes No No Yes, macOS only No
Function: True if the receiver is a subview of a given view or if it's identical to that view; otherwise, it returns false.

Feedback, Comments & Corrections

NSViewMBS.makeBackingLayer as Variant
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 13.1 Yes No No Yes, macOS only No
Function: Creates the view's backing layer.
Notes:
Value is a CALayerMBS object.
Available in OS X v10.6 and later.

Feedback, Comments & Corrections

NSViewMBS.nextValidKeyView as NSViewMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 13.2 Yes No No Yes, macOS only No
Function: Returns the closest view object in the key view loop that follows the receiver and accepts first responder status.
Notes:
This method ignores hidden views when it determines the next valid key view.
Returns nil on any error.

Feedback, Comments & Corrections

NSViewMBS.noteFocusRingMaskChanged
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 12.3 Yes No No Yes, macOS only No
Function: Invoked to notify the view that the focus ring mask requires updating.
Notes:
It is important to note that it is only necessary for developers to invoke this method when some internal state change of their application, that the Application Kit can't determine, affects the shape of the focus ring mask.

It is assumed that if the view is marked as needing display, or is resized, its focus ring shape is likely to have changed, and there is no need for clients to explicitly send this message in such cases, they are handled automatically.

If, however, a view is showing a focus ring around some part of its content (an NSImage, perhaps), and that content changes, the client must provide notification by invoking this method so that focusRingMaskBounds and drawFocusRingMask will be invoked to redraw the focus ring.
Available in Mac OS X v10.7 and later.

Feedback, Comments & Corrections

NSViewMBS.pageFooter as NSAttributedStringMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 12.4 Yes No No Yes, macOS only No
Function: Returns a default footer string that includes the current page number and page count.
Notes:
A printable view class can override this method to substitute its own content in place of the default value. You should not need to call this method directly. The printing system calls it once per page during printing.

Footers are generated only if the user defaults contain the key NSPrintHeaderAndFooter with the value true.

Feedback, Comments & Corrections

NSViewMBS.pageHeader as NSAttributedStringMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 12.4 Yes No No Yes, macOS only No
Function: Returns a default header string that includes the print job title and date.
Notes:
Typically, the print job title is the same as the window title. A printable view class can override this method to substitute its own content in place of the default value. You should not need to call this method directly. The printing system calls it once per page during printing.

Headers are generated only if the user defaults contain the key NSPrintHeaderAndFooter with the value true.

Feedback, Comments & Corrections

NSViewMBS.previousKeyView as NSViewMBS
Type Topic Plugin Version macOS Windows Linux Console & Web iOS
method Cocoa MBS MacBase Plugin 13.2 Yes No No Yes, macOS only No
Function: Returns the view object preceding the receiver in the key view loop.
Notes:
This view should, if possible, be made first responder when the user navigates backward from the receiver using keyboard interface control.
Returns nil on any error.

Feedback, Comments & Corrections

Next items

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




Links
MBS Xojo tutorial videos