Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSWindowMBS class.

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
Var 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
Var 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
Var w as NSWindowMBS = window1.NSWindowMBS
Var fr as NSRectMBS = w.frame
Var 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.

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


The biggest plugin in space...