Platforms to show: All Mac Windows Linux Cross-Platform
Back to NSStatusItemMBS class.
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
method | Statusitem | MBS MacCocoa Plugin | 7.2 | ✅ Yes | ❌ No | ❌ No | ❌ No | Desktop only |
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 |
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:
- /MacCocoa/NSStatusItem/Display current IP
- /MacCocoa/NSStatusItem/Display current iTunes Song
- /MacCocoa/NSStatusItem/Name in menu bar
- /MacCocoa/NSStatusItem/StatusItem
- /MacCocoa/NSStatusItem/StatusItem with Image in menu
- /MacCocoa/NSStatusItem/StatusItem with NSView
- /MacCocoa/NSStatusItem/StatusItem with PDF Icon
- /MacCocoa/NSStatusItem/Statusitem with PopOver
- /MacCocoa/NSStatusItem/Statusitem with PopOver using Container
- /MacCocoa/NSStatusItem/Statusitem with slider in menubar
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 |
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 |
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 |
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 |
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 |
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 |
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.