OSX Status Menu

Deploying to Mac OS? Ask Mac OS specific questions here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Neurox66
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 120
Joined: Tue May 22, 2012 1:57 pm
Location: Vicenza (Italy)
Contact:

OSX Status Menu

Post by Neurox66 » Fri Jun 05, 2015 5:08 pm

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

Thanks,
Paolo
Paolo Borzini | paolo@borzini.it
The WhiteFly Software | www.thewhitefly.it
Service on line for printers | www.4pellicole.it


Neurox66
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 120
Joined: Tue May 22, 2012 1:57 pm
Location: Vicenza (Italy)
Contact:

Re: OSX Status Menu

Post by Neurox66 » Tue Jun 16, 2015 7:04 am

Hi Paul,
thank you for the reply but the link is for Xcode :)

I've found an experimental command in LiveCode 4.5 Release Notes – Revision 13:

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.
But don't work in OS X nor Windows7 :(

Paolo
Paolo Borzini | paolo@borzini.it
The WhiteFly Software | www.thewhitefly.it
Service on line for printers | www.4pellicole.it

Klaus
Posts: 13828
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: OSX Status Menu

Post by Klaus » Tue Jun 16, 2015 5:26 pm

Buongiorno Paolo,

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!


Best

Klaus

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: OSX Status Menu

Post by SparkOut » Tue Jun 16, 2015 10:58 pm

It works on Windows. At least it did last time I used it. Not that that helps you.

Neurox66
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 120
Joined: Tue May 22, 2012 1:57 pm
Location: Vicenza (Italy)
Contact:

Re: OSX Status Menu

Post by Neurox66 » Wed Jun 17, 2015 6:13 am

Hi SparkOut,
SparkOut wrote:It works on Windows.
What version of Windows?

Because my attempts with Windows 7 are unsuccessful.

Paolo
Paolo Borzini | paolo@borzini.it
The WhiteFly Software | www.thewhitefly.it
Service on line for printers | www.4pellicole.it

Neurox66
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 120
Joined: Tue May 22, 2012 1:57 pm
Location: Vicenza (Italy)
Contact:

Re: OSX Status Menu

Post by Neurox66 » Wed Jun 17, 2015 6:22 am

Guten morgen Klaus,
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!
In fact, from what is written in the 4.5 release notes:
"This feature is currently experimental"

After it was written ...
"Please do not be afraid to try it out as we need feedback to develop it further"

...but from 4.5 to 7.6 it seems to have not done anything yet,
perhaps they did not have enough feedback :shock: :D

Paolo
Paolo Borzini | paolo@borzini.it
The WhiteFly Software | www.thewhitefly.it
Service on line for printers | www.4pellicole.it

SparkOut
Posts: 2852
Joined: Sun Sep 23, 2007 4:58 pm

Re: OSX Status Menu

Post by SparkOut » Wed Jun 17, 2015 7:38 am

This stack still works on Windows 7 in LC 7.0.5, tested just now in the IDE.
On uniconifying you will probably have to mess around with the stack shape and size.

Edit: Although any mention of the status icon in the Dictionary seems to have vanished. (Maybe because it was only on Windows and Windows 8 doesn't seem to have a status icon area that works like that?)
Attachments
statusIconMenuTest.zip
(3.68 KiB) Downloaded 279 times

Neurox66
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 120
Joined: Tue May 22, 2012 1:57 pm
Location: Vicenza (Italy)
Contact:

Re: OSX Status Menu

Post by Neurox66 » Thu Jun 18, 2015 6:29 am

Hi SparkOut,
thanks for the sample.

But on my Windows 7 64bit in .exe format not work :(

Paolo
Paolo Borzini | paolo@borzini.it
The WhiteFly Software | www.thewhitefly.it
Service on line for printers | www.4pellicole.it

mrcoollion
Posts: 720
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: OSX Status Menu

Post by mrcoollion » Sat Aug 22, 2015 9:27 pm

I have got it working in Windows 10 64 bits (LiveCode Indy 7.1 (rc 1)).
I did the following :
Step one:
Make a new stack with the name: TestWinTray
add a hidden icon (jpg) with 32x32 pixels (set isonsize to 32 x 32) and give the icon the id number 21006 (otherwise this example will not work)
then copy the following in the main stack

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

Step two:
Put a button on that stack named : test iconify . This button must be there because without it it does not work (not clear why). Just hide it if you do not use it.

put the following script in the button:

Code: Select all

on mouseUp
   set the iconic of this stack to true
   set the statusIcon to 21006
end mouseUp
And last step three:

Place the following code in the main card

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
When stack is hidden click on the icon with right mouse button to see your choices.
Hope this works for you as well.
I also uploaded the stack as it works for me however after initial startup of the stack the first time I minimize the stack the pickmenu on the icon does not work, maximize again *by selecting it from livecode and after this it magically keeps working ???? Maybe someone has a suggestion ?


Kind regards,

MrCoolLion (Paul)
Attachments
WinSysTrayExample1.zip
(1.49 KiB) Downloaded 281 times

PaulDaMacMan
Posts: 627
Joined: Wed Apr 24, 2013 4:53 pm
Contact:

Re: OSX Status Menu

Post by PaulDaMacMan » Fri Oct 09, 2015 7:30 pm

Not specifically for LiveCode but this tool could probably be used to achieve custom made Mac StatusBar with LC interaction via shell scripting with out ever using X-Code:
http://web.mit.edu/cron/system/macathen ... ation.html

There was another creating tool called Tapir but it's old/outdated (though source-code is available).
My GitHub Repos: https://github.com/PaulMcClernan/
Related YouTube Videos: PlayList

Post Reply

Return to “Mac OS”