Platforms to show: All Mac Windows Linux Cross-Platform

Back to NSStatusItemMBS class.

NSStatusItemMBS.Close

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Statusitem MBS MacCocoa Plugin 7.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
The destructor.

There is no need to call this method except you want to free all resources of this object now without waiting for Xojo to do it for you.

NSStatusItemMBS.CreateMenu as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Statusitem MBS MacCocoa Plugin 7.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Creates a new menu.

Handle is not 0 after this call was successfull.

If the NSGrayBackground option is set in the system defaults, Mac OS X 10.5 will raise an NSImageCacheException, so please install an exception handle to catch NSExceptionMBS so your application can handle that.

See also:

Some examples using this method:

NSStatusItemMBS.CreateMenu(length as single) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Statusitem MBS MacCocoa Plugin 7.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Creates the StatusItem menu with the given width.
Example
dim e as new NSStatusItemMBS
call e.CreateMenu(24) // best for a 16x16 picture

Constants:
NSVariableStatusItemLength-1
NSSquareStatusItemLength-2

Other values between 0 and 10000 are used for the length.
Bad values like 20000 will crash the application.

Handle is not 0 after this call was successfull.

If the NSGrayBackground option is set in the system defaults, Mac OS X 10.5 will raise an NSImageCacheException, so please install an exception handle to catch NSExceptionMBS so your application can handle that.

See also:

NSStatusItemMBS.CreateMenuMiddle(length as single) as boolean   Deprecated

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Statusitem MBS MacCocoa Plugin 7.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
This item is deprecated and should no longer be used. You can use CreateMenu instead.
Same as CreateMenu but tries to place Statusitem on the right side.

Uses private Apple API which may break on future Mac OS X versions. Returns false if Apple changes something in the future and the function we use will not be available. So if this function returns false, you can call CreateMenu to continue. Works on Mac OS X 10.4 to 10.6 and make the new statusitem being the rightmost one (left to Apples MenuItems).

Constants:
NSVariableStatusItemLength-1
NSSquareStatusItemLength-2

Other values between 0 and 10000 are used for the length.
Bad values like 20000 will crash the application.

Handle is not 0 after this call was successfull.

If the NSGrayBackground option is set in the system defaults, Mac OS X 10.5 will raise an NSImageCacheException, so please install an exception handle to catch NSExceptionMBS so your application can handle that.

Deprecated.

NSStatusItemMBS.CreateMenuRight(length as single) as boolean   Deprecated

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Statusitem MBS MacCocoa Plugin 7.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
This item is deprecated and should no longer be used. You can use CreateMenu instead.
Same as CreateMenu but tries to place Statusitem on the right side.

Uses private Apple API which may break on future Mac OS X versions. Returns false if Apple changes something in the future and the function we use will not be available. So if this function returns false, you can call CreateMenu to continue. Works on Mac OS X 10.4 to 10.6 and make the new statusitem being the rightmost one.

If you run this code after you used CreateMenuRight, the new menu will be right of all other statusitems:

dim sh as new Shell
sh.Execute "killall","SystemUIServer"

Constants:
NSVariableStatusItemLength-1
NSSquareStatusItemLength-2

Other values between 0 and 10000 are used for the length.
Bad values like 20000 will crash the application.

Handle is not 0 after this call was successfull.

If the NSGrayBackground option is set in the system defaults, Mac OS X 10.5 will raise an NSImageCacheException, so please install an exception handle to catch NSExceptionMBS so your application can handle that.

Deprecated.

NSStatusItemMBS.DrawStatusBarBackground(x as Double, y as Double, width as Double, height as Double, highlight as boolean)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Statusitem MBS MacCocoa Plugin 7.7 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Draws the menu background pattern for a custom status-bar item in regular or highlight pattern.

x, y, width and height: A rectangle defining the area of a custom status-bar item.
highlight: true to draw the background pattern in the standard highlight pattern, false to not highlight the pattern.

You can use this method to help a custom status-bar item emulate the behavior of a standard item.

Available in Mac OS X v10.3 and later.

Some examples using this method:

NSStatusItemMBS.popUpStatusItemMenu(menu as NSMenuMBS)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Statusitem MBS MacCocoa Plugin 7.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Displays a menu under a custom status bar item.

You can use this method to cause a popup menu to appear under a custom status bar item when the user clicks the item. Note that view must exist (that is, it must not be nil).

Some examples using this method:

NSStatusItemMBS.SendActionOn(mode as Integer)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Statusitem MBS MacCocoa Plugin 7.2 ✅ Yes ❌ No ❌ No ❌ No Desktop only
Sets the conditions on which action event is called.

mask is set with one or more of the following bit masks described in NSEvent Constants: NSLeftMouseUpMask, NSLeftMouseDownMask, NSLeftMouseDraggedMask, and NSPeriodicMask.

mode is set with one or more of the following bit masks:

const NSLeftMouseDownMask = &h00002
const NSLeftMouseUpMask = &H00004
const NSLeftMouseDraggedMask= &h00040
const NSPeriodicMask = &h10000

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


The biggest plugin in space...