How to possible create an app which run in OSX Status Menu?

Thanks,
Paolo
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Code: Select all
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.
What version of Windows?SparkOut wrote:It works on Windows.
In fact, from what is written in the 4.5 release notes:Klaus wrote: I'm afraid this has never been implemented correctly (or at all, can't remember this one and I have an elephants memory!),
so this does of course not work in any version of Livecode on any platform, sorry!
Code: Select all
on preOpenStack
set the statusIcon to 0 // Just to make sure there is no icon of this stack showing. Should not be necessary
end preOpenStack
on unIconifyStack
show this stack
set the statusIcon to 0 // does work
pass unIconifyStack
end unIconifyStack
on iconifyStack
send "hideme" to me in 50 millisecs -- bug 7531
set the statusIcon to 21006
set the statusIconMenu to "Show" & cr & "Other"
pass iconifyStack
end iconifyStack
Code: Select all
on mouseUp
set the iconic of this stack to true
set the statusIcon to 21006
end mouseUp
Code: Select all
on statusIconMenuPick pPick
if pPick is "Show" then
answer "Going to show"
set the statusIcon to 0
set the iconic of stack "TestWinTray" to false
end if
if pPick is "Other" then
answer "Doing other"
end if
if pPick is not "Show" and pPick is not "Other" then
answer "not Show, not Other"
end if
end statusIconMenuPick