Launch app from MacOSX system bar

Richard Gaskin ambassador at fourthworld.com
Sat Oct 2 11:53:50 EDT 2010


 From the v4.5 release notes:

----------------------------------------------------------------

Status icon support (experimental)

Windows, Linux and Mac OS X all have an area where so-called 'status 
icons' can be displayed. On Windows this is the system tray on the 
bottom right of the start bar, on Linux this is typically the right of 
the panel at the top of the screen, and on Mac OS X this is on the menubar.

The engine has support for adding a single status icon, and it can be 
configured using the statusIcon, the statusIconTooltip and the 
statusIconMenu:

set the statusIcon to imageId set the statusIconMenu to iconMenuSpec set 
the statusIconToolTip to toolTip

Here imageId is the id of the image you wish to use as the icon. It will 
be scaled down automatically to the appropriate size for the platform 
and then set. The toolTip specifies what message appears when the user 
hovers over the status icon.

The iconMenuSpec allows you to configure a menu that will appear when 
the user does a 'menu' click on the icon. This string uses a subset of 
the standard engine menu specification:
[ <tab> * ] [ '(' ] <label> [ '|' <tag> ] Here the number of tabs 
determines the depth of the menu (i.e. use this to create sub-menus).

The optional tag is used when calling the statusIconMenuPick message.
Before the engine displays the status icon menu, it will send a 
statusIconMenuOpening menu to the current card of the defaultStack. You 
can use this opportunity to change the icon menu before it is displayed, 
this is an analog to handling mouseDown in a menu button.
When the user selects an item from the dock menu, the engine will send 
an statusIconMenuPick message to the current card of the default stack:
iconMenuPick which Here which will be a list of labels or tags (if 
specified) separated by '|' which determines which item
was selected. In addition, the engine will send the following message in 
response to clicks on the icon:

statusIconMenuClick button
statusIconMenuDoubleClick button

You can use these to perform an appropriate action.

Note: If you wish to display a menu from the status icon you must use 
the statusIconMenu property, attempting to open a normal popup menu in 
response to one of the click messages is not guaranteed to work.
Note: This syntax is only implemented on Windows at the moment and 
replaces the previously unsupported use of the icon and the iconMenu for 
this purpose. The properties specified above will have no effect on Mac 
OS X and Linux at this time.

Important: This feature is currently experimental. This means that it 
may not be complete, or may fail in some circumstances that you would 
expect it to work. Please do not be afraid to try it out as we need 
feedback to develop it further.

----------------------------------------------------------------

--
  Richard Gaskin
  Fourth World
  LiveCode training and consulting: http://www.fourthworld.com
  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv



More information about the use-livecode mailing list