Platforms to show: All Mac Windows Linux Cross-Platform
Back to NSWindowMBS class.
NSWindowMBS.saveFrameUsingName(s as String)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 15.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
With the companion method setFrameUsingName, you can save and reset an NSWindow object's frame over various launches of an application. The default is owned by the application and stored under the name "NSWindow Frame frameName". See NSUserDefaults for more information.
NSWindowMBS.selectKeyViewFollowingView(view as NSViewMBS)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Sends the nextValidKeyView message to referenceView and, if that message returns an NSView object, invokes makeFirstResponder with the returned object.
NSWindowMBS.selectKeyViewPrecedingView(view as NSViewMBS)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Sends the nextValidKeyView message to referenceView and, if that message returns an NSView object, invokes makeFirstResponder with the returned object.
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
The candidate is one of the following (searched for in this order):
- The current first responder's next valid key view, as returned by the nextValidKeyView method of NSView
- The object designated as the window's initial first responder (using setInitialFirstResponder) if it returns true to an acceptsFirstResponder message
- Otherwise, the initial first responder's next valid key view, which may end up being nil
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 16.5 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Raises an exception when used on OS X 10.11 and older.
NSWindowMBS.selectPreviousKeyView
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
The candidate is one of the following (searched for in this order):
- The current first responder's previous valid key view, as returned by the previousValidKeyView method of NSView
- The object designated as the window's initial first responder (using setInitialFirstResponder) if it returns true to an acceptsFirstResponder message
- Otherwise, the initial first responder's previous valid key view, which may end up being nil
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 16.5 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Raises an exception when used on OS X 10.11 and older.
NSWindowMBS.sendEvent(e as NSEventMBS)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Never invoke this method directly. A right mouse-down event in a window of an inactive application is not delivered to the corresponding NSWindow object. It is instead delivered to the NSApplication object through a sendEvent: message with a window number of 0.
NSWindowMBS.setAutorecalculatesContentBorderThickness(flag as boolean, edge as Integer)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 11.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
flag: If true, the window calculates the thickness of the edge automatically; if false, it does not.
edge: The border whose thickness auto-recalculation status to set:
NSMaxYEdge: Top border.
NSMinYEdge: Bottom border.
Special Considerations
Turning off a border's auto-recalculation status sets its border thickness to 0.0.
In a non-textured window calling setAutorecalculatesContentBorderThickness passing NSMaxYEdge will raise an exception. It is only valid to set the content border thickness of the top edge in a textured window.
Requires Mac OS X 10.5.
Some examples using this method:
NSWindowMBS.setBottomCornerRounded(flag as boolean)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
This is an undocumented function in the NSWindow class.
NSWindowMBS.setContentBorderThickness(thickness as Double, edge as Integer)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 11.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
thickness: The thickness for edge, in points.
edge: The border whose thickness to set:
NSMaxYEdge: Top border.
NSMinYEdge: Bottom border.
In a non-textured window calling setContentBorderThickness passing NSMaxYEdge will raise an exception. It is only valid to set the content border thickness of the top edge in a textured window.
The contentBorder does not include the titlebar or toolbar, so a textured window that just wants the gradient in the titlebar and toolbar should have a contentBorderThickness of 0 for NSMaxYEdge.
Requires Mac OS X 10.5.
Some examples using this method:
NSWindowMBS.setContentSize(size as NSSizeMBS)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
This size in turn alters the size of the NSWindow object itself. Note that the window server limits window sizes to 10,000; if necessary, be sure to limit aSize relative to the frame rectangle.
NSWindowMBS.setFrame(frameRect as NSRectMBS)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
frameRect: The frame rectangle for the window, including the title bar.
Note that the window server limits window position coordinates to ±16,000 and sizes to 10,000.
See also:
- setFrame(frameRect as NSRectMBS, display as boolean)
- setFrame(frameRect as NSRectMBS, display as boolean, animated as boolean)
- SetFrame(left as Double, top as Double, width as Double, height as Double)
Some examples using this method:
NSWindowMBS.setFrame(frameRect as NSRectMBS, display as boolean)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 8.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
The point 0/0 is on the bottom left position of the main screen.
display: Specifies whether the window redraws the views that need to be displayed. When true the window sends a displayIfNeeded message down its view hierarchy, thus redrawing all views.
See also:
NSWindowMBS.setFrame(frameRect as NSRectMBS, display as boolean, animated as boolean)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
The point 0/0 is on the bottom left position of the main screen.
If animated is true, the change is animated.
See also:
NSWindowMBS.SetFrame(left as Double, top as Double, width as Double, height as Double)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
The point 0/0 is on the bottom left position of the main screen.
See also:
NSWindowMBS.setFrameAutosaveName(name as String) as boolean
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 15.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Returns true when the frame name is set successfully; false when frameName is being used as an autosave name by another NSWindow object in the application (in which case the window's old name remains in effect).
If frameName isn't the empty string (""), the window's frame is saved as a user default (as described in saveFrameUsingName) each time the frame changes.
When the window has an autosave name, its frame data is written whenever the frame rectangle changes.
If there is a frame rectangle previously stored for frameName in the user defaults, the window's frame is set to this frame rectangle. That is, when you call this method with a previously used frameName, the window picks up the previously saved setting. For example, if you call setFrameAutosaveName for a window that is already onscreen, this method could cause the window to move to a different screen location. For this reason, it is generally better to call this method before the window is visible on screen.
Keep in mind that a window controller may change the window's position when it displays it if window cascading is turned on. To preclude the window controller from changing a window's position from the one saved in the defaults system, you must send setShouldCascadeWindows(false) to the window controller.
NSWindowMBS.setFrameFromString(s as String)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 15.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
If the window is not resizable, this method will not resize the window. The frame is constrained according to the window's minimum and maximum size settings. This method can cause a windowWillResize event.
NSWindowMBS.setFrameOrigin(point as NSPointMBS)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Note that the window server limits window position coordinates to ±16,000.
NSWindowMBS.setFrameTopLeftPoint(point as NSPointMBS)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Note that the window server limits window position coordinates to ±16,000; if necessary, adjust aPoint relative to the window's lower-left corner to account for this limit.
NSWindowMBS.setFrameUsingName(name as String, force as boolean = false) as boolean
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 15.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Returns true when frameName is read and the frame is set successfully; otherwise, false.
The frame is constrained according to the window's minimum and maximum size settings. This method causes a windowWillResize event.
NSWindowMBS.setRestorationClass
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
The plugin provides a class to restore windows. See NSWindowRestoreHandlerMBS class.
The restoration class of a window is responsible for recreating not just the window but any other objects needed to manage the window. Therefore, the restoration class must be able to create (or find existing instances of) all of these objects at launch time in your application.
If you mark your windows as restorable, you must associate a restoration class with them.
Available in OS X v10.7 and later.
Some examples using this method:
NSWindowMBS.setTitleWithRepresentedFile(filename as folderitem)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
NSWindowMBS.setTitleWithRepresentedFilename(filename as string)
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 8.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
NSWindowMBS.standardWindowButton(button as Integer) as Variant
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 12.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
button: The kind of standard window button to return.
Returns Window button in the window's view hierarchy of the kind identified by windowButtonKind; nil when such button is not in the window's view hierarchy.
Declared as Variant for reduced plugin dependencies.
Button constants: NSWindowCloseButton, NSWindowDocumentIconButton, NSWindowMiniaturizeButton, NSWindowToolbarButton and NSWindowZoomButton.
See also:
Some examples using this method:
NSWindowMBS.stringWithSavedFrame as String
| Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
| method | Cocoa | MBS MacBase Plugin | 15.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
A string representation of the window's frame rectangle in a format that can be used with a later setFrameFromString method.
The items on this page are in the following plugins: MBS MacBase Plugin.