Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSApplicationMBS class.

NSApplicationMBS.activationPolicy as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The application's activation policy.

Currently, NSApplicationActivationPolicyNone and NSApplicationActivationPolicyAccessory may be changed to NSApplicationActivationPolicyRegular, but other modifications are not supported.

Update: Seems to work better newer MacOS versions, so between 10.6 and 10.15 Apple implemented more transitions.

Available in Mac OS X v10.6 and later.
(Read and Write property)

NSApplicationMBS.applicationIconImage as NSImageMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The image used for the receiver's icon.
Example
dim pic as Picture = LogoMBS(500)
dim mask as new Picture(500, 500, 32)
dim g as Graphics = mask.Graphics

g.ForeColor = &cFFFFFF
g.FillRect 0,0,g.Width, g.Height
g.ForeColor = &c000000
g.FillOval 0,0,g.Width, g.Height

dim n as new NSImageMBS(pic,mask)

NSApplicationMBS.sharedApplication.applicationIconImage = n

An image containing the application's icon.

This property can set the icon in the dock application tile. This method scales the image as necessary so that it fits in the dock tile. You can use this method to change your application icon while running. To restore your application's original icon, you pass nil to this method.
(Read and Write property)

NSApplicationMBS.currentEvent as NSEventMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the current event, the last event the receiver retrieved from the event queue.
Example
dim e as NSEventMBS = NSApplicationMBS.sharedApplication.currentEvent

The last event object retrieved by the application.

NSApp receives events and forwards them to the affected NSWindow objects, which then distribute them to the objects in its view hierarchy.

Only for Cocoa applications.
(Read only property)

NSApplicationMBS.currentSystemPresentationOptions as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the set of application presentation options that are currently in effect for the system.
Example
dim a as new NSApplicationMBS

MsgBox "currentSystemPresentationOptions: "+str(a.currentSystemPresentationOptions)

The presentation options. See NSApplicationPresentation* constants and combine them using a C bitwise OR operator.

These are the presentation options that have been put into effect by the currently active application.
(Read only property)

NSApplicationMBS.dockTile as NSDockTileMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the application's Dock tile.
Example
dim a as new NSApplicationMBS

a.dockTile.badgeLabel = "Hello"

Available in Mac OS X v10.5 and later.

Returns NSDockTileMBS object for the dock tile.
(Read only property)

NSApplicationMBS.Handle as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
The internal reference to the NSApplication object.

(Read and Write property)

NSApplicationMBS.helpMenu as NSMenuMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The help menu used by the application.

If helpMenu is nil, the system will append the help to an appropriate menu and will not return a reference to that menu when this method is called.

Available in Mac OS X v10.6 and later.

If helpMenu is a non-nil menu it is set as the Help menu, and Spotlight for Help will be installed in it. If helpMenu is nil, AppKit will install Spotlight for Help into a menu of its choosing, and that menu is not returned from helpMenu.

If you wish to completely suppress Spotlight for Help, you can set a menu that does not appear in the menu bar.

NSApplication retains its Help menu and releases it when a different menu is set.
(Read and Write property)

NSApplicationMBS.isActive as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a Boolean value indicating whether this is the active application.
Example
dim a as NSApplicationMBS = NSApplicationMBS.sharedApplication
MsgBox "isActive:" +str(a.isActive)

True if this is the active application; false otherwise.
(Read only property)

NSApplicationMBS.isFullKeyboardAccessEnabled as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns that status of Full Keyboard Access set in the Keyboard preference pane.
Example
dim a as NSApplicationMBS = NSApplicationMBS.sharedApplication
MsgBox "isFullKeyboardAccessEnabled:" +str(a.isFullKeyboardAccessEnabled)

True if Full Keyboard Access is enabled, otherwise false.

You may use this status to implement your own key loop or to implement in-control tabbing behavior similar to NSTableView.

Available in Mac OS X v10.6 and later.
(Read only property)

NSApplicationMBS.isHidden as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a Boolean value indicating whether the receiver is hidden.
Example
MsgBox str(NSApplicationMBS.sharedApplication.isHidden)

True if the receiver is hidden, false otherwise.
(Read only property)

NSApplicationMBS.isRunning as Boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 11.1 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a Boolean value indicating whether the main event loop is running.
Example
MsgBox str(NSApplicationMBS.sharedApplication.isRunning)

True if the main event loop is running; false otherwise.
False means the stop: method was invoked.

Should always be true for a Xojo application.
(Read only property)

NSApplicationMBS.keyWindow as NSWindowMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the window that currently receives keyboard events.
Example
// title of front window
MsgBox NSApplicationMBS.sharedApplication.keyWindow.Title

The window object currently receiving keyboard events or nil if there is no key window.
This method might return nil if the application hasn't finished loading yet or if the receiver is not active.

Does return nil in Carbon applications.
(Read only property)

Some examples using this property:

NSApplicationMBS.mainMenu as NSMenuMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The menu object representing the application's menu bar.
Example
// shows titles of the menus in a Cocoa app
dim m as NSMenuMBS = NSApplicationMBS.sharedApplication.mainMenu

if m<>nil then
dim c as Integer = m.numberOfItems-1
for i as Integer = 0 to c

MsgBox m.Item(i).Title
next
end if

Returns nil on a Carbon application.
(Read and Write property)

NSApplicationMBS.mainWindow as NSWindowMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Returns the main window.
Example
// shows title in Cocoa, but not in Carbon
MsgBox NSApplicationMBS.sharedApplication.mainWindow.Title

The application's main window or nil if there is no main window.
This method might return nil if the application hasn't finished loading, if the receiver is not active, or if the application is hidden.
(Read only property)

Some examples using this property:

NSApplicationMBS.presentationOptions as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 11.2 ✅ Yes ❌ No ❌ No ✅ Yes All
The presentation options that should be in effect for the system when this application is active.
Example
dim a as new NSApplicationMBS

// hide dock
a.presentationOptions = NSApplicationMBS.NSApplicationPresentationAutoHideDock

Available in Mac OS X v10.6 and later.

Only certain combinations of "NSApplicationPresentationOptions" flags are supported. When given an invalid combination of option flags this method raises an exception NSInvalidArgumentException exception..

See NSApplicationPresentation* constants.
(Read and Write property)

NSApplicationMBS.servicesProvider as NSServiceProviderMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 14.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Registers or queries the service provider.

The service provider is an object that performs all services the application provides to other applications. When another application requests a service from the receiver, it sends the service request to aProvider. Service requests can arrive immediately after the service provider is set, so invoke this method only when your application is ready to receive requests.

Please keep an object reference around so the object is not going out of scope too early!
(Read and Write property)

Some examples using this property:

NSApplicationMBS.userInterfaceLayoutDirection as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 16.3 ✅ Yes ❌ No ❌ No ✅ Yes All
The layout direction of the user interface.

This property contains the general user interface layout flow directions. For a list of possible values, see NSUserInterfaceLayoutDirection.

NSUserInterfaceLayoutDirectionLeftToRight = 0
NSUserInterfaceLayoutDirectionRightToLeft = 1

Available in OS X v10.6 and later.
(Read only property)

NSApplicationMBS.windowsMenu as NSMenuMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
property Cocoa MBS MacCocoa Plugin 11.1 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The window menu or nil if such a menu does not exist or has not yet been created.

(Read and Write property)

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


The biggest plugin in space...