Systray2 request Thread last updated on 2003-11-18 14:16:15

Posted by member 71746 on 2003-11-14 18:48:58

I'm wondering if anyone has the spare time and talent to add a function to systray2...

I've seen some modules with something like...
ModuleNameWaitForBoxHook
...wherein it loads all the settings but before it "builds" the window it waits until it's called into an LsBox.

I'd like to have that for Systray2.

Practical Application of Given Theory:

To hook the systray into an LsBox and have it execute OnAdd/OnDel commands to resize and move the tray.

Modules must be loaded before LsBox in order to be hooked into a box. Systray2 fully loads in a very efficient manor. Unfortunately, it results in all the icons being added to the tray before the box is created, so all the resizing/moving commands float into /dev/null/ so to speak, and the box is created with it's default size/position.

With the proposed feature, Systray2 could be loaded and read its configuration, and wait until it receives its !SystrayHook before loading any icons.

Helpful Info:

I think kClock has a command like kClockInBox or kClockWaitForBoxHook or something along those lines..

Anyone with litestep coding experience should be able to pilfer the routines from kClock to wait for a box hook, and I can't imagine it'd be too hard to make the icons wait for a box if SystrayWaitForBox is specified.

With any luck someone with "da-SkillZ" ;) should be able to whip up this update in 10 mimutes :)

Posted by member 7223 on 2003-11-14 23:32:03 link

Now that skinbox have been released, there's no reason to use lsbox anymore.
With skinbox, you can load systray2 via "*script start" lines (to avoid systrayonadd/del calling undefined bangs) and hook it to your skinbox only after that; like this:
*script start !netreloadmodule $systray$
*script start !skinboxexec systraybox !systrayhook .none {@ih}

Posted by member 99 on 2003-11-15 00:51:44 link

Er, there's still a lot of reasons to use lsbox. It's much easier to use, it's actually designed to be used that way, and it can load older modules.

And really the only tricky bit with systray here is getting a notice when it hooks into lsbox. You can actually do that by understanding the syntax of box hooks and writing a mzscript bang to emulate it:
*script bang !MySystrayHook
*script exec !SystrayHook %{\1} %{\2}
*script exec !SetBoxSizeFromStoredValue
*script ~bang
*ModuleHook !MySystrayHook
(will need adjusting if you use userdata)

Then you just need to keep an absolute value for the desired size/position that you update in OnAdd/Del, I suppose you can probably figure that one out. ;)

Posted by member 71746 on 2003-11-15 01:41:09 link

Smurth, the problem is specifically that systray2 is too efficient - it loads itself completely before moving on to the next instruction (ie, to load ls box and get hooked). That means that by the time...
*script start !skinboxexec systraybox !systrayhook .none {@ih}
...is called, ...
*script start !netreloadmodule $systray$
...has completely finished, and all the OnAdd's and OnDel's have run their course.


RabidCow, what's with the %{\1} and \2?
and is !SetBoxSizeFromStoredValue just implying a script I would create to set the box size/position?
Your proposed solution inspires an easier option to achieve the same means.. The problem is that the OnAdd/Del's are being executed before the Hooking occurs, so I could use something like

SystrayOnAdd !IconAdded
SystrayOnDel !IconDeleted

*script bang !IconAdded
*script exec !varAdd trayheight 20
*script exec !varAdd traypos -20
; add the exec's to move and resize the lsbox
*script ~bang

*script bang !IconDeleted
*script exec !varAdd trayheight -20
*script exec !varAdd traypos 20
; add the exec's to move and resize the lsbox
*script ~bang

Then reference an bang like !InitTheme with *Script start, and have it contain:

*Script exec !NetReloadModule systray2-2.0.1
*Script exec !LsBoxMoveBox -32 %{traypos}
*Script exec !LsBoxResize 32 %{traywidth}

That way any time an icon is added after the initial startup/recycle sequence, the box hears the commands to be resized and moved, but even before lsbox is loaded, when the initial startup/recycle sequence happens and the OnAdd/OnDel's are triggered, the variable is set, and the init script then resizes/moves the lsbox to the size/position it's supposed to be. Peasants rejoice, velvet curtains part, champagne falls from the heavens. (Not in bottles..)

I'll try it in the morning, glad I got it written down ;)

Posted by member 99 on 2003-11-15 11:10:04 link

Ah, you're missing out :)

%{\1} is the first argument to the bang command
%{\2} is the second, etc.

But your *script start method does look better :) I just never think of solving load order problems that way.

Posted by member 71746 on 2003-11-15 12:52:20 link

Rabid, I feel that I am indeed missing out ;) So for the \1 and \2 would I put like
!SystrayHook %{boxname}
or something like that?

And what's the deal with userdata? I can't find any docs explaining what its all about anywhere...

Thanks :)

Posted by member 71746 on 2003-11-15 13:42:26 link

K so I've tried that proposed solution and it doesn't work ;) The problem is still that the OnAdd/OnDel bangs get called before mzScript is loaded and the bangs exists, so the variables don't change as they haven't been created yet.

What I need is a way to set variables when Systray2 initializes, and a way to add/subtract from those modules without using mzScript.

I'd like to be able to just define the TrayHeight and TrayPos as E-Vars, but I don't know of any way to perform math functions on EVars.. I know this wouldn't work..

SystrayOnAdd $TrayPos-20$

...as all that will do is evaluate TrayPos-20, and try to execute the result..

So, is there a built-into-litestep way to manipulate EVars? If not, is there a module that will let you change EVar values on the fly?

Posted by member 37809 on 2003-11-15 15:12:38 link

I used to have this sort of conflict, but don't remember what I did to resolve it.

Currently I use VTray and set [Tray]CheckOnCommands false.
Is VTray boxable?

Posted by member 71746 on 2003-11-15 17:45:48 link

VTray claims to be boxable, it supports [Tray]Hook, but when it's hooked into a box none of the icons update. (ie, zonealarm doesn't flash the net in/out, instant messages don't flash, mirc doesn't animate on activity, etc. Just static icons.)

VTray can be loaded into a box via a *WharfModule line, and it will update properly, but then it can't auto-size.

If no one knows of a module or way to manipulate EVars post-loading-sequence, does anyone have the time to put together such a module? Seems like something that'd be a breeze to anyone with litestep module coding experience..

You could even use envvars.dll as a base, and just change it so instead of modifying Windows e-vars, it modifies Litestep e-vars...

Posted by member 71746 on 2003-11-15 20:57:11 link

So I've found a way to accomplish what I need to accomplish - instead of using *NetLoadModule and a !Hook, I'm using *WharfModule to load systray2-lsbox (doesn't work with sysray2-2.0.1 as it has too efficient of a loading routine)

Still it'd be nice to have a module or ideally a built-into-litestep.exe method of changing e-vars.
Maybe something like

!EVarSet $EVarName$ "new string/value"
; this would set a new value for the given evar

!EVarEval $EVarName$ (equation)
; this would evaluate (equation) and place the result in $EVarName$

Example:
Simple counter:

theme.rc:
Counter 0
; defines the e-var $Counter$

hotkey.rc:
*Hotkey Win C !EVarEval $Counter$ $Counter+1$
; increments $Counter$ by one
*Hotkey Win A !Alert "We're up to $Counter$ so far..." "Current Count"
; displays counter data

Posted by member 7 on 2003-11-18 11:36:26 link

Try starting systray2 hidden... or does this also execute OnAdd/OnDel commands?

Posted by member 71746 on 2003-11-18 14:16:15 link

ilm, it does still execute OnAdd/OnDel commands. Presumably so when you call the !Systrayshow bang it shows instantly instead of loading all the icons..