Windows system tray icon

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
rblackmore245
Posts: 67
Joined: Fri Jun 12, 2015 9:42 am

Windows system tray icon

Post by rblackmore245 » Tue Dec 12, 2017 11:18 am

I am unable to find any correct upto date information on how to create a system tray icon for my app when its minimized and then listen out for the event of a double click on the icon to restore the app window.

AndyP
Posts: 614
Joined: Wed Aug 27, 2008 12:57 pm
Location: Seeheim, Germany (ex UK)
Contact:

Re: Windows system tray icon

Post by AndyP » Tue Dec 12, 2017 1:42 pm

If you are using a standard window then this should be automatically taken care of.
The icon will be your exe application icon.

If you are using a custom window shape then you can use this

In the mimimize button script:

on mouseUp
--reset the windowshape to default and add a minimise button, required due to iconic command bug
set the decorations of this stack to "minimize"
set the iconic of this stack to true
end mouseUp

In the stack script:

In the stack script:
on unIconifyStack
-- revert to original window shape, doing so automatically removes the minimise decoration
set windowShape of me to <your background image id>
end unIconifyStack
Andy Piddock
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Windows system tray icon

Post by shaosean » Tue Dec 12, 2017 3:15 pm

rblackmore245 wrote:
Tue Dec 12, 2017 11:18 am
I am unable to find any correct upto date information on how to create a system tray icon for my app when its minimized and then listen out for the event of a double click on the icon to restore the app window.
I don't think there is the ability to put an icon in the system tray, but it is something that one could look at doing with LiveCode Builder..

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Windows system tray icon

Post by bogs » Tue Dec 12, 2017 3:18 pm

The wording does make it hard to tell if he is talking about the actual 'system tray' or the 'task bar' in this case. I believe Andy's reply was referring to the second one, but as I said, the description of what is actually trying to be accomplished sounds confusing.

I think the system tray is supported in some fashion without LCB due to threads like this one.
Last edited by bogs on Tue Dec 12, 2017 3:21 pm, edited 1 time in total.
Image

shaosean
Posts: 906
Joined: Thu Nov 04, 2010 7:53 am

Re: Windows system tray icon

Post by shaosean » Tue Dec 12, 2017 3:21 pm

Actually, his wording does make sense.. Way back in the day, when I had used Windows and WinAMP, WinAMP had the ability to minimize to the system tray (not the task bar) and then double-clicking the system tray icon would maximize it..

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Windows system tray icon

Post by bogs » Tue Dec 12, 2017 3:24 pm

I was just trying to say the wording is a bit confusing, the fact that 2 people put up 2 replies about 2 different things tends to bear that out :)

As I was editing my above post, I came across this thread in the link ->
bogs wrote:
Tue Dec 12, 2017 3:18 pm
I think the system tray is supported in some fashion without LCB due to threads like this one.
I also came across this from Key Ray's site, but it was written in trayscript.

*Edit - I also came across this from the venerable Mark Schonewille which may help -
Add a menu to the dock or system tray icon
This stack helps you create a script that adds a menu to the icon in the Dock of Mac OS X or the system tray of Windows.
*Edit 2 - This thread also had some information in it, and further explanation of Mark's example can be found here.

I will say, I also didn't find anything that would be considered "up to date", but that may be due to it
. a) not being a big concern (not a lot of requests) or
. b) because existing solutions are available, or
. c) 'other' :mrgreen:

Dunno which, or why.
Image

rblackmore245
Posts: 67
Joined: Fri Jun 12, 2015 9:42 am

Re: Windows system tray icon

Post by rblackmore245 » Wed Dec 13, 2017 10:57 am

Yes sorry I did mean minimize the application to the systemtray, I did find a solution deep in the forums ages ago but it didn't seem reliable.

As I do not want the application icon hogging the task bar but still need to notify the user that it is still running and give them the option to restore this application to the foreground.

MaxV
Posts: 1579
Joined: Tue May 28, 2013 2:20 pm
Location: Italy
Contact:

Re: Windows system tray icon

Post by MaxV » Wed Dec 13, 2017 9:56 pm

The livecode update checker use the systemtray (systray).
What command or property did it use?
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Windows system tray icon

Post by bogs » Wed Dec 13, 2017 10:01 pm

MaxV wrote:
Wed Dec 13, 2017 9:56 pm
The livecode update checker use the systemtray (systray).
What command or property did it use?
LOL, that is right, the updater does run in the sys tray, I had forgotten since thats the first thing I turn off in settings :oops:
Image

LiveCode_Panos
Livecode Staff Member
Livecode Staff Member
Posts: 818
Joined: Fri Feb 06, 2015 4:03 pm

Re: Windows system tray icon

Post by LiveCode_Panos » Thu Dec 14, 2017 1:05 pm

Hi all,

See comments 3 and 4 in this bug report for a working solution:

http://quality.livecode.com/show_bug.cgi?id=20762

Best,
Panos
--

bogs
Posts: 5435
Joined: Sat Feb 25, 2017 10:45 pm

Re: Windows system tray icon

Post by bogs » Thu Dec 14, 2017 3:52 pm

Wow, now that is impressive, the OP found undocumented features, and Max's bug report got a response in a couple days explaining how to over come that. Btw, thank you Panos for the work arounds :)

*Edit - interesting information in the stack comments you might want to pay attention to if your using this technique and any database script operations in Win7.

*Edit - also interesting that this does not appear to work on Linux, where as the updater *does* appear able to put a system tray icon (notification area).
Image

AndyP
Posts: 614
Joined: Wed Aug 27, 2008 12:57 pm
Location: Seeheim, Germany (ex UK)
Contact:

Re: Windows system tray icon

Post by AndyP » Fri Dec 15, 2017 8:02 am

Excellent sleuthing!

Definitely one for my snippets lib.
Andy Piddock
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search

rblackmore245
Posts: 67
Joined: Fri Jun 12, 2015 9:42 am

Re: Windows system tray icon

Post by rblackmore245 » Fri Dec 15, 2017 5:58 pm

Yeah found it also via the facebook livecode page:


on mouseup

set the statusicon to 1004
set the statusicontooltip to "This is a test"
set the statusIconMenu to "Show" & cr & "Other"
end mouseup

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

matthiasr
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 190
Joined: Sat Apr 08, 2006 7:55 am
Location: Lübbecke, Germany
Contact:

Re: Windows system tray icon

Post by matthiasr » Tue Dec 19, 2017 5:55 pm

@Panos

this makes me remembering that i asked Livecode Mark when he or Kevin introduced the Mac OSX native button at LC Global about the possibility to add a status icon to the Mac OS X menu bar. He promised to check. And at a later LC global i asked again and he said that he will ask Ali to have a look at it.

Could you be so kind and ask/check if there was further progress on this?

We are using the status icon and the menu in windows for quite a long time now and it would be great to have something similar for Mac OS X.

Regards,
Matthias

Post Reply

Return to “Windows”