Platforms to show: All Mac Windows Linux Cross-Platform
Back to NSWindowMBS class.
NSWindowMBS.inLiveResize as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Available in Mac OS X v10.6 and later.
NSWindowMBS.invalidateCursorRectsForView(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 |
NSWindowMBS.invalidateRestorableState
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 13.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
At some point in the future, encodeRestorableStateWithCoder: will be called to encode the restorable state. You should not override this method.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 8.4 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
NSWindowMBS.keyDown(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 |
event: The keyboard event to process.
NSWindowMBS.makeFirstResponder(r as NSResponderMBS) as boolean
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
responder: The responder to set as the window's first responder. nil makes the window its first responder.
Returns true when the operation is successful; otherwise, false.
If responder isn't already the first responder, this method first sends a resignFirstResponder message to the object that is the first responder. If that object refuses to resign, it remains the first responder, and this method immediately returns false. If the current first responder resigns, this method sends a becomeFirstResponder message to responder. If responder does not accept first responder status, the NSWindow object becomes first responder; in this case, the method returns true even if responder refuses first responder status.
If responder is nil, this method still sends resignFirstResponder to the current first responder. If the current first responder refuses to resign, it remains the first responder and this method immediately returns false. If the current first responder returns true from resignFirstResponder, the window is made its own first responder and this method returns true.
The Application Kit framework uses this method to alter the first responder in response to mouse-down events; you can also use it to explicitly set the first responder from within your program. The responder object is typically an NSView object in the window's view hierarchy. If this method is called explicitly, first send acceptsFirstResponder to responder, and do not call makeFirstResponder if acceptsFirstResponder returns false.
Use setInitialFirstResponder to the set the first responder to be used when the window is brought onscreen for the first time.
NSWindowMBS.makeKeyAndOrderFront
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
More or less the same as Xojo's show command on the window class.
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 | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
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.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 8.4 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Some examples using this method:
NSWindowMBS.moveTabToNewWindow
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.
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 | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
NSWindowMBS.orderFrontRegardless
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Normally an NSWindow object can't be moved in front of the key window unless it and the key window are in the same application. You should rarely need to invoke this method; it's designed to be used when applications are cooperating in such a way that an active application (with the key window) is using another application to display data.
Available in Mac OS X v10.0 and later.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 11.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
More or less the same as Xojo's hide command on the window class.
If the window is the key or main window, the NSWindow object immediately behind it is made key or main in its place. Calling the orderOut method causes the window to be removed from the screen, but does not cause it to be released. See the close method for information on when a window is released.
The default animation based on the window type will be used when the window is ordered out unless it has been modified by the setAnimationBehavior method.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 8.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Same as if the user clicks the close button.
So if the button is disabled or closing is not permitted by the window, it will do nothing.
NSWindowMBS.performMiniaturize
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 8.4 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
If the receiver doesn't have a minimize button or can't be minimized for some reason, the system emits the alert sound.
Some examples using this method:
NSWindowMBS.performWindowDragWithEvent(event as NSEventMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 20.3 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
event: The original mouse-down event received by the application or a view. If you don't have a NSEvent object, please pass the one from NSApplicationMBS.currentEvent here.
Your application (or a view) can call this method after receiving and examining a mouse-down event. Upon examination of the event, a view may allow that portion of the window to start a window drag and can hand off the work to the Window Server process by calling this method. Doing so allows the window to participate in space switching and other system features.
This method returns right away, and a mouse-up event may not get sent.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 8.4 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
If the receiver doesn't have a zoom box or can't be zoomed for some reason, the computer beeps.
Some examples using this method:
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
NSWindowMBS.registerForDraggedTypes(Types() as string)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 11.1 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Types: An array of the pasteboard types the window will accept as the destination of an image-dragging session.
Registering an NSWindow object for dragged types automatically makes it a candidate destination object for a dragging session. NSWindow has a default implementation for many of the methods in the NSDraggingDestination informal protocol. The default implementation forwards each message to the delegate if the delegate responds to the selector of the message. The messages forwarded this way are draggingEntered:, draggingUpdated:, draggingExited:, prepareForDragOperation:, performDragOperation:, and concludeDragOperation:.
Xojo with Cocoa target implements the methods listed above. So this method is useful to change the allowed types for the case the framework has a bug.
NSWindowMBS.removeChildWindow(win as NSWindowMBS)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
win: The child window to detach.
See also:
Some examples using this method:
NSWindowMBS.removeChildWindow(win as window)
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 11.2 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
win: The child window to detach.
See also:
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
Invokes discardCursorRects to clear the window's cursor rectangles, then sends resetCursorRects to every NSView object in the window's view hierarchy.
This method is typically invoked by the NSApplication object when it detects that the key window's cursor rectangles are invalid. In program code, it's more efficient to invoke invalidateCursorRectsForView.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
This method sends resignKeyWindow to the window's first responder, sends windowDidResignKey to the window's delegate, and posts an NSWindowDidResignKeyNotification to the default notification center.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
This method sends windowDidResignMain to the window's delegate and posts an NSWindowDidResignMainNotification to the default notification center.
NSWindowMBS.resizeFlags as Integer
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
A mask indicating which of the modifier keys was held down when the mouse-down event occurred. The flags are listed in NSEvent object's modifierFlags method description.
This method is valid only while the window is being resized
You can use this method to constrain the direction or amount of resizing. Because of its limited validity, this method should only be invoked from within an implementation of the delegate method windowWillResize.
NSWindowMBS.restoreCachedImage
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Cocoa | MBS MacBase Plugin | 9.6 | ✅ Yes | ❌ No | ❌ No | ✅ Yes | Desktop & iOS |
You must invoke flushWindow after this method to guarantee proper redisplay. An NSWindow object automatically discards its cached image rectangles when it displays.
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.
The items on this page are in the following plugins: MBS MacBase Plugin.