Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 18 in printed book and digital formats -- plus a one-year subscription (beginning with 19.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview

Buy Now

Issue 5.6


Third Party Plugins: Statusitems

Getting an icon in the top right of the Mac OS X menubar

Issue: 5.6 (September/October 2007)
Author: Christian Schmitz
Author Bio: Christian Schmitz is the creator of the Monkeybread Software REALbasic Plugins.
Article Description: No description available.
Article Length (in bytes): 16,958
Starting Page Number: 31
Article Number: 5611
Resource File(s):

Download Icon 5611.zip Updated: 2007-09-14 19:41:07

Related Web Link(s):


Excerpt of article text...

Recently I had a request for a time tracking application to add a fast profile switching feature, like the one found in Skype. Skype -- and also iChat -- allow the use of a global menu item to switch the users status.

How to do that?

Technically, the only possible way to get something in this menu is to use the NSStatusItem class from Cocoa. And the most complete set of classes which covers that for REALbasic are the classes in the Monkeybread Software REALbasic plug-ins. Of course you can do everything yourself by writing your own classes and sending objective C messages using the objective C runtime methods. But before you do that, you may consider to just use the plugins as they save you a lot of time in creating and debugging code.

Install the plug-ins into REALbasic so you have the NSStatusItemMBS class at hand from the Cocoa plugin part. This article is based on version 7.4 of the MBS Plugins. Of course a newer version may be better because of some bugs being fixed.

Integration in Application

Once you decide to use a global menu for your application you have to think on how you implement it. Is this a part of your application or an extra background application? As being part of the application the menu only appears if the application is running. I use this way for my time tracking application where the menu switches the current profile. The profile can only be switched while the application is running, so an extra application is not needed. Other applications like iChat do it different. They are divided into two parts: in iChat's case, they are iChat and iChatAgent. Doing the menu in a separate application has several advantages. First you can keep the menu in the menubar even if your main application is not running. Second, you have two applications and if one crashes, the other can take over and relaunch the other. Third, you can provide an application launcher for your application. So if the user clicks on the menu and the main application is not running, you can launch it.

...End of Excerpt. Please purchase the magazine to read the full article.