Working in system tray

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

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Working in system tray

Post by alemrantareq » Fri Jan 23, 2009 1:22 pm

Hi everybody,

Is there any idea to show the app icon in system tray rather than in taskbar? :lol:

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

Post by SparkOut » Sat Jan 24, 2009 11:05 am

A simple search for "tray" will get you a selection of useful threads, if it's not immediately apparent that the item currently 8th below the sticky post at the top of the Windows forum is "Minimize to system tray" (by Paul D). That has some useful info and examples.

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Sat Jan 24, 2009 4:41 pm

alemrantareq,

There s a system tray sample in RevOnline, user name Mark.

Best,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Post by alemrantareq » Sun Jan 25, 2009 6:15 am

Thanks SparkOut & Mark for your replies.

I've seen the samples before creating this topic. I just want to create a simple clock which will show its icon in the system tray but not be hidden and not show the taskbar icon. So, I've made the following stack script -

Code: Select all

on preOpenstack
  set the flag of me to not the flag of me
  if the flag of me then startpolling
end preOpenstack

on startPolling
  palette this stack
  set the icon to 1009
  set the raisepalettes to true
  set the iconMenu to "Close"
  put the time into fld "time"
  if the flag of me then send "startPolling" to me in 100 millisecs
end startPolling

on iconMenuPick theItem
  if theItem is "Close" then quit
end iconMenuPick
Problem is that if I make the stack palette, it doesnt update the time, and it shows taskbar icon if the stack is normal.

Mark's sample is fantastic but its made by "hide" command. I dont want to hide my stack rather it will float above the window.

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

Post by SparkOut » Sun Jan 25, 2009 11:42 am

Use a mainstack and substack approach.
If you make the display card in the substack and set it to be a palette, and the mainstack a normal stack which you hide with the example techniques shown that should work.
Put the polling handlers in the mainstack so that they remain active while minimised to tray, and just extend the line

Code: Select all

put the time into fld "time"
to

Code: Select all

put the time into fld "time" of card "displayCard" of stack "timerSubstack"

alemrantareq
Posts: 203
Joined: Wed Jul 23, 2008 8:46 am

Post by alemrantareq » Mon Jan 26, 2009 5:53 pm

Oh ! I've failed :(

I've created a substack and put a field to show the time. then I made the main stack hidden n keep it in startpolling to put the time into that field. If I make the substack palette, it works no more, but works in normal stack. And in normal stack, I cant hide it from the taskbar.

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Contact:

Post by Janschenkel » Mon Jan 26, 2009 10:02 pm

There are two things you can try: either set the systemWindow of your palette stack to true so that it floats above all other windows, or set the style of your stack to modeless to prevent the stack from appearing in the taskbar.

HTH,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

Post Reply