Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSWindowMBS class.

Next items

NSWindowMBS.addChildWindow(win as DesktopWindow, order as integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 22.0 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Adds a given window as a child window of the window.

win: The child window to order.
order: Either NSWindowAbove: childWindow is ordered immediately in front of the window, or NSWindowBelow: childWindow is ordered immediately behind the window.

After the childWindow is added as a child of the window, it is maintained in relative position indicated by order mode for subsequent ordering operations involving either window. While this attachment is active, moving childWindow will not cause the window to move (as in sliding a drawer in or out), but moving the window will cause childWindow to move.

Note that you should not create cycles between parent and child windows. For example, you should not add window B as child of window A, then add window A as a child of window B.

See also:

Some examples using this method:

NSWindowMBS.addChildWindow(win as NSWindowMBS, order as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Adds a given window as a child window of the window.

win: The child window to order.
order: Either NSWindowAbove: childWindow is ordered immediately in front of the window, or NSWindowBelow: childWindow is ordered immediately behind the window.

After the childWindow is added as a child of the window, it is maintained in relative position indicated by order mode for subsequent ordering operations involving either window. While this attachment is active, moving childWindow will not cause the window to move (as in sliding a drawer in or out), but moving the window will cause childWindow to move.

Note that you should not create cycles between parent and child windows. For example, you should not add window B as child of window A, then add window A as a child of window B.

See also:

NSWindowMBS.addChildWindow(win as window, order as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Adds a given window as a child window of the window.

win: The child window to order.
order: Either NSWindowAbove: childWindow is ordered immediately in front of the window, or NSWindowBelow: childWindow is ordered immediately behind the window.

After the childWindow is added as a child of the window, it is maintained in relative position indicated by order mode for subsequent ordering operations involving either window. While this attachment is active, moving childWindow will not cause the window to move (as in sliding a drawer in or out), but moving the window will cause childWindow to move.

Note that you should not create cycles between parent and child windows. For example, you should not add window B as child of window A, then add window A as a child of window B.

See also:

NSWindowMBS.addTabbedWindow(win as NSWindowMBS, ordered as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 16.5 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Allows creating a group of tabbed windows, or adding a new window to an existing tabbed window group.
Example
dim n as NSWindowMBS = window1.NSWindowMBS

n.addTabbedWindow(Window2, n.NSWindowAbove)

The 'window' will be added to the receiver's tabbed window group, or create a group if needed. The tabbingIdentifier for the entire group should be the same for all the windows, otherwise an exception will be thrown. Use the ordered parameter with "NSWindowAbove" and "NSWindowBelow" to place the new window before or after the receiver's tab. Passing "NSWindowOut" will thrown an exception. Currently this method is not animatable, but that may change in the future.
Raises an exception when used on OS X 10.11 and older.

NSWindowMBS.animator as NSWindowMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 10.0 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns the proxy object for this window which animates.
Example
dim v as NSWindowMBS // your NSWindowMBS object

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

NSWindowMBS.areCursorRectsEnabled as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Whether the window's cursor rectangles are enabled.

Available in Mac OS X v10.0 and later.

NSWindowMBS.attachedSheet as NSWindowMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns the sheet attached to the window.

The sheet attached to the window; nil when the window doesn't have a sheet attached.

Available in Mac OS X v10.1 and later.

NSWindowMBS.autorecalculatesContentBorderThicknessForEdge(edge as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Indicates whether the window calculates the thickness of a given border automatically.

edge: Border whose thickness autorecalculation status to set:

NSMaxYEdge: Top border.
NSMinYEdge: Bottom border.

Returns true when the window auto-recalculates the given border's thickness; otherwise, false.

Requires Mac OS X 10.5.

NSWindowMBS.becomeKeyWindow

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Invoked automatically to inform the window that it has become the key window; never invoke this method directly.

This method reestablishes the window's first responder, sends the becomeKeyWindow message to that object if it responds, and posts an NSWindowDidBecomeKeyNotification to the default notification center.

NSWindowMBS.becomeMainWindow

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Invoked automatically to inform the window that it has become the main window; never invoke this method directly.

NSWindowMBS.cacheImageInRect(r as NSRectMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Stores the window's raster image from a given rectangle expressed in the window's base coordinate system.

This method allows the window to perform temporary drawing, such as a band around the selection as the user drags the mouse, and to quickly restore the previous image by invoking restoreCachedImage and flushWindowIfNeeded. The next time the window displays, it discards its cached image rectangles. You can also explicitly use discardCachedImage to free the memory occupied by cached image rectangles. aRect is made integral before caching the image to avoid antialiasing artifacts.

Only the last cached rectangle is remembered and can be restored.

NSWindowMBS.Center

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 8.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Sets the window's location to the center of the screen.

The window is placed exactly in the center horizontally and somewhat above center vertically. Such a placement carries a certain visual immediacy and importance. This method doesn't put the receiver onscreen, however; use makeKeyAndOrderFront (show) to do that.

You typically use this method to place a window—most likely an alert dialog—where the user can't miss it. This method is invoked automatically when a panel is placed on the screen by the runModalForWindow method of the NSApplication class.

NSWindowMBS.childWindows as NSWindowMBS()

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns an array of the window's attached child windows.

NSWindowMBS.ClearFocus

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 8.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Clears the focus.

Moves the focus back to the window.

NSWindowMBS.Close

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 8.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Closes the window.

NSWindowMBS.Constructor(w as DesktopWindow)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 22.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Creates a NSWindow for the given Xojo window.
Example
dim w as new NSWindowMBS(window1)

MsgBox w.Title

See also:

NSWindowMBS.Constructor(w as window)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.4 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Creates a NSWindow for the given Xojo window.
Example
dim w as new NSWindowMBS(window1)

MsgBox w.Title

In plugin version 9.4 and newer this works only with Cocoa windows.
In plugin version 9.7 and newer you can use it also for Carbon windows.

See also:

NSWindowMBS.Constructor(x as Double, y as Double, w as Double, h as Double, styleMask as Integer, BackingStoreType as Integer = 0, deferCreation as boolean = false, canBecomeKeyWindow as boolean = false)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 8.4 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
The constructor to create a new Cocoa Windows.

x,y,w,h:
Location and size of the window's content area in screen coordinates. Note that the window server limits window position coordinates to ±16,000 and sizes to 10,000.

styleMask:
The window's style. Either it can be NSBorderlessWindowMask, or it can contain any of the options described in the constants, combined using the bitwiseOR function. Borderless windows display none of the usual peripheral elements and are generally useful only for display or caching purposes; you should normally not need to create them. Also, note that a window's style mask should include NSTitledWindowMask if it includes any of the others.

bufferingType:
Specifies how the drawing done in the window is buffered by the window device, and possible values are described in "Constants."

deferCreation:
Specifies whether the window server creates a window device for the window immediately. When true, the window server defers creating the window device until the window is moved onscreen. All display messages sent to the window or its views are postponed until the window is created, just before it's moved onscreen.

Initialized NSWindow object.

This method is the designated initializer for the NSWindow class.

Deferring the creation of the window improves launch time and minimizes the virtual memory load on the window server.

The new window creates a view to be its default content view. You can replace it with your own object by using the ContentView property.

Parameter canBecomeKeyWindow (in 11.3 plugin) controls whether we use a special NSWindow subclass which returns true for the canBecomeKeyWindow function. This way you can create windows which can take key focus.

See also:

NSWindowMBS.contentBorderThicknessForEdge(edge as Integer) as Double

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Indicates the thickness of a given border of the window.

edge: The border whose thickness to get:

NSMaxYEdge: Top border.
NSMinYEdge: Bottom border.

Requires Mac OS X 10.5.

NSWindowMBS.contentRectForFrameRect(windowFrame as NSRectMBS) as NSRectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns the window's content rectangle with a given frame rectangle.
Example
dim w as NSWindowMBS = window1.NSWindowMBS
dim fr as NSRectMBS = w.frame
dim cr as NSRectMBS = w.contentRectForFrameRect(fr)

MsgBox "Title height: "+str(fr.Height-cr.Height)

windowFrame: The frame rectangle for the window expressed in screen coordinates.

Returns the window's content rectangle, expressed in screen coordinates, with windowFrame.

The window uses its current style mask in computing the content rectangle. See Window Style Mask constants for a list of style mask values. The main advantage of this instance-method counterpart to contentRectForFrameRect (With styleMask) is that it allows you to take toolbars into account when converting between content and frame rectangles. (The toolbar is not included in the content rectangle.)

See also:

NSWindowMBS.convertBaseToScreen(p as NSPointMBS) as NSPointMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Converts a given point from the window's base coordinate system to the screen coordinate system.

NSWindowMBS.convertScreenToBase(p as NSPointMBS) as NSPointMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Converts a given point from the screen coordinate system to the window's base coordinate system.

NSWindowMBS.dataWithEPSInsideRect(r as NSRectMBS) as Memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns EPS data that draws the region of the window within a given rectangle.

This data can be placed on a pasteboard, written to a file, or used to create an NSImage object.

NSWindowMBS.dataWithPDFInsideRect(r as NSRectMBS) as Memoryblock

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns PDF data that draws the region of the window within a given rectangle.

This data can be placed on a pasteboard, written to a file, or used to create an NSImage object.

NSWindowMBS.deminiaturize

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 8.4 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
This action method deminimizes the receiver.

Invoke this method to programmatically deminimize a minimized window in the Dock.

NSWindowMBS.disableCursorRects

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Disables all cursor rectangle management within the window.

Use this method when you need to do some special cursor manipulation and you don't want the Application Kit interfering.

NSWindowMBS.disableFlushWindow

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Disables the flushWindow method for the window.

If the window is buffered, disabling flushWindow prevents drawing from being automatically flushed by the NSView display... methods from the window's backing store to the screen. This method permits several views to be drawn before the results are shown to the user.

Flushing should be disabled only temporarily, while the window's display is being updated. Each disableFlushWindow message must be paired with a subsequent enableFlushWindow message. Invocations of these methods can be nested; flushing isn't reenabled until the last (unnested) enableFlushWindow message is sent.

NSWindowMBS.disableScreenUpdatesUntilFlush

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Disables the window's screen updates until the window is flushed.

This method can be invoked to synchronize hardware surface flushes with the window's flushes. The window immediately disables screen updates using the NSDisableScreenUpdates function and reenables screen updates when the window flushes. Sending this message multiple times during a window update cycle has no effect.

Available in Mac OS X v10.4 and later.

NSWindowMBS.disableSnapshotRestoration

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Disable snapshot restoration.

While snapshot restoration is disabled, the window will not be snapshotted for restorable state.
Available in OS X v10.7 and later.

NSWindowMBS.discardCachedImage

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Discards all of the window's cached image rectangles.

An NSWindow object automatically discards its cached image rectangles when it displays.

NSWindowMBS.discardCursorRects

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Invalidates all cursor rectangles in the window.

This method is invoked by resetCursorRects to clear out existing cursor rectangles before resetting them. You shouldn't invoke it in the code you write, but you might want to override it to change its behavior.

NSWindowMBS.display

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Passes a display message down the window's view hierarchy, thus redrawing all views within the window, including the frame view that draws the border, title bar, and other peripheral elements.

You rarely need to invoke this method. NSWindow objects normally record which of their views need display and display them automatically on each pass through the event loop.

NSWindowMBS.displayIfNeeded

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Passes a displayIfNeeded message down the window's view hierarchy, thus redrawing all views that need to be displayed, including the frame view that draws the border, title bar, and other peripheral elements.

This method is useful when you want to modify some number of views and then display only the ones that were modified.

You rarely need to invoke this method. NSWindow objects normally record which of their views need display and display them automatically on each pass through the event loop.

NSWindowMBS.dockTile as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Provides the application's Dock tile.

Available in Mac OS X v10.5 and later.

Returns NSDockTileMBS object for the dock tile.

NSWindowMBS.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 iOS Targets
method Cocoa MBS MacBase Plugin 13.5 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Begins a dragging session.

image: The object to be dragged.
imageLocation: Location of the image's bottom-left corner in the window's coordinate system. It determines the placement of the dragged image under the pointer.
offset: The pointer's location relative to the mouse-down location. Not used in OS X v10.4 and later.
NSEvent: The left-mouse down event that triggered the dragging operation.
pasteboard: The pasteboard that holds the data to be transferred to the destination.
source: The object serving as the controller of the dragging operation. It must conform to the NSDraggingSource protocol.
slideBack: Specifies whether the drag image should slide back to imageLocation if it's rejected by the drag destination. Pass true to specify slide back behavior or false to specify that it should not.

This method should be invoked only from within a view's implementation of the mouseDown or mouseDragged methods (which overrides the version defined in NSResponder class). Essentially the same as the NSView method of the same name, except that imageLocation is given in the NSWindow object's base coordinate system.

NSWindowMBS.enableCursorRects

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Reenables cursor rectangle management within the window after a disableCursorRects message.

NSWindowMBS.enableFlushWindow

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Reenables the flushWindow method for the window after it was disabled through a previous disableFlushWindow message.

NSWindowMBS.enableSnapshotRestoration

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Enable snapshot restoration.

While snapshot restoration is enabled, the window will be snapshotted for restorable state.
Available in OS X v10.7 and later.

NSWindowMBS.endEditingFor(anObject as object = nil)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 13.4 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Forces the field editor to give up its first responder status and prepares it for its next assignment.

anObject: The object that is using the window's field editor.

If the field editor is the first responder, it's made to resign that status even if its resignFirstResponder method returns false. This registration forces the field editor to send a textDidEndEditing message to its delegate. The field editor is then removed from the view hierarchy, its delegate is set to nil, and it's emptied of any text it may contain.

This method is typically invoked by the object using the field editor when it's finished. Other objects normally change the first responder by simply using makeFirstResponder, which allows a field editor or other object to retain its first responder status if, for example, the user has entered an invalid value. The endEditingFor: method should be used only as a last resort if the field editor refuses to resign first responder status. Even in this case, you should always allow the field editor a chance to validate its text and take whatever other action it needs first. You can do this by first trying to make the NSWindow object the first responder.

NSWindowMBS.fieldEditor(createFlag as boolean = True, forObject as object = nil) as Variant

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 13.4 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns the window's field editor, creating it if requested.

Returns NSTextMBS object. Returned as Variant to reduce plugin dependencies.

createWhenNeeded: If true, creates a field editor if one doesn't exist; if false, does not create a field editor.
A freshly created NSWindow object doesn't have a field editor. After a field editor has been created for a window, the createWhenNeeded argument is ignored. By passing false for createWhenNeeded and testing the return value, however, you can predicate an action on the existence of the field editor.
forObject: A text-displaying object for which the delegate (in windowWillReturnFieldEditor) assigns a custom field editor. Pass nil to get the default field editor, which can be the NSWindow field editor or a custom field editor returned by the delegate.

Returns the field editor for the designated object (anObject) or, if anObject is nil, the default field editor. Returns nil if createFlag is false and if the field editor doesn't exist.

The field editor is a single NSTextView object that is shared among all the controls in a window for light text-editing needs. It is automatically instantiated when needed, and it can be used however your application sees fit. Typically, the field editor is used by simple text-bearing objects—for example, an NSTextField object uses its window's field editor to display and manipulate text. The field editor can be shared by any number of objects, and so its state may be constantly changing. Therefore, it shouldn't be used to display text that demands sophisticated layout (for this you should create a dedicated NSTextView object).

The field editor may be in use by some view object, so be sure to properly dissociate it from that object before actually using it yourself (the appropriate way to do this is illustrated in the description of endEditingFor:). Once you retrieve the field editor, you can insert it in the view hierarchy, set a delegate to interpret text events, and have it perform whatever editing is needed. Then, when it sends a textDidEndEditing message to the delegate, you can get its text to display or store and remove the field editor using endEditingFor.

The window's delegate can substitute a custom field editor in place of the window's field editor by implementing windowWillReturnFieldEditor. The custom field editor can become the default editor (common to all text-displaying objects) or specific to a particular text-displaying object (anObject). The window sends this message to its delegate with itself and anObject as the arguments; if the delegate returns a non-nil value, the window returns that object instead of its field editor in fieldEditor. However, note the following:

If the window's delegate is identical to anObject, windowWillReturnFieldEditor isn't sent to the delegate.
The object returned by the delegate method, though it may become first responder, does not become the window's default field editor. Other objects continue to use the window's default field editor.

NSWindowMBS.firstResponder as NSResponderMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
The window's first responder.

The first responder is usually the first object in a responder chain to receive an event or action message. In most cases, the first responder is a view object in that the user selects or activates with the mouse or keyboard.

You can use the firstResponder method in custom subclasses of responder classes (NSWindow, NSApplication, NSView, and subclasses) to determine if an instance of the subclass is currently the first responder. You can also use it to help locate a text field that currently has first-responder status. For more on this subject, see Event Handling Basics (on developer.apple.com).

NSWindowMBS.flushWindow

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Flushes the window's offscreen buffer to the screen if the window is buffered and flushing is enabled.

Does nothing for other display devices, such as a printer. This method is automatically invoked by the NSWindow display and displayIfNeeded methods and the corresponding NSView display and displayIfNeeded methods.

NSWindowMBS.flushWindowIfNeeded

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Flushes the window's offscreen buffer to the screen if flushing is enabled and if the last flushWindow message had no effect because flushing was disabled.

To avoid unnecessary flushing, use this method rather than flushWindow to flush an NSWindow object after flushing has been reenabled.

NSWindowMBS.frameAutosaveName as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacBase Plugin 15.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
The name used to automatically save the window's frame rectangle data in the defaults system.

(Read and Write computed property)

Some examples using this property:

NSWindowMBS.frameRectForContentRect(windowContent as NSRectMBS) as NSRectMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 11.3 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns the window's frame rectangle with a given content rectangle.

windowContent: The content rectangle for the window expressed in screen coordinates.

Returns the window's frame rectangle, expressed in screen coordinates, with windowContent.

The window uses its current style mask in computing the frame rectangle. See "Window Style Masks" for a list of style mask values. The major advantage of this instance-method counterpart to frameRectForContentRect (with styleMask) is that it allows you to take toolbars into account when converting between content and frame rectangles. (The toolbar is included in the frame rectangle but not the content rectangle.)

See also:

NSWindowMBS.GetFrame(byref left as Double, byref top as Double, byref width as Double, byref height as Double)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 8.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Asks for the current window dimensions.

The point 0/0 is on the left bottom position.

NSWindowMBS.gState as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 9.6 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Returns the window's graphics state object.

This graphics state is used by default for all NSView objects in the window's view hierarchy, but individual views can be made to use their own with the NSView method allocateGState.

NSWindowMBS.Hide

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Cocoa MBS MacBase Plugin 8.2 ✅ Yes ❌ No ❌ No ✅ Yes Desktop & iOS
Hides the window.

Next items

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


The biggest plugin in space...