Keeping SysTray2 Centered Thread last updated on 2004-04-12 06:54:38

Posted by member 17899 on 2004-04-10 21:39:31

In creating a very simple theme, I would like to have Systray centered at the bottom of the screen. This is my Systray2.rc:

------------------------------------------------------

;___________
; Systray2 /
;_________/


SystrayAutoSize TRUE
SystrayX $resolutionx/2$
SystrayY -30
SystrayIconSpacingX 2
SystrayIconSpacingY 4
SystrayBorderSize 2
SystrayDirection Right
SystrayIconSize 16
SystrayWrapCount 0


SystrayBGColor FF00FF
SystrayBorderColor FF00FF

-----------------------------------------------------

What do I need to add, using !SystrayMove, in order to keep the tray centered, when icons are added or removed, instead of merely extending to the left or right?

Thanks for any help...

Rodger

Posted by member 1 on 2004-04-10 22:06:22 link

how about moving your systray + or - 9 based on OnAdd or OnDel

Posted by member 17899 on 2004-04-10 22:20:41 link

If I add...

SystrayOnAdd !SystrayMove -9
SystrayOnDel !SystrayMove +9

The tray disappears! :o(

Rodger

Posted by member 37809 on 2004-04-10 23:15:50 link

I don't know if systray2 has it (docs might not be updated?) but VTray has a ![Tray]MoveBy bang so you can give it deltas as you do above.

Posted by member 12025 on 2004-04-10 23:55:31 link

(in a normal .rc file)
SysTrayOnAdd !Systray_Add
SysTrayOnDel !SysTray_Del

(in a script file)
trayXpos $ResolutionX/2$

*script bang !Systray_Add
*script exec !varAdd trayXpos -9
*script exec !SystrayMove %{trayXpos} -30
*script ~bang

*script bang !Systray_Del
*script exec !varAdd trayXpos 9
*script exec !SystrayMove %{trayXpos} -30
*script ~bang

Posted by member 17899 on 2004-04-11 11:07:32 link

Sorry Cerbie, that doesn't seem to work either.

For some reason, your script simply moves the tray to the lower left corner and keeps it there. It looks like it SHOULD work though. :\ I thought this would be simple but it is becoming frustrating.

Anyone have any other ideas?

Posted by member 37809 on 2004-04-11 12:14:46 link

This has pink artifacts:
*NetLoadModule vtray-1.10

VTraySettingsCompatibility
SystrayX $ResolutionX/2$
SystrayY $ResolutionY-30$
SystraySnap false
SystrayDirection Right
SystrayWrapDirection Down
SystrayBGColor FF00FF
SystrayBorderColor FF00FF
SystrayIconSpacingX 2
SystrayIconSpacingY 4
SystrayBorderSize 2
SystrayHideIfEmpty true
SystrayDoNotCheckOnCommands true
SystrayIconSize 16
SystrayRememberIcons false
SystrayAutoSize true
SystrayWrapCount 0
SystrayOnAdd !SystrayMoveBy -9 +0
SystrayOnDel !SystrayMoveBy +9 +0


For Cerbie's code, did you put
trayXpos $ResolutionX/2$
in a *mzVarFile? Inside a script file it should be
*script var trayXpos $ResolutionX/2$

Posted by member 17899 on 2004-04-11 13:06:42 link

This is Script.rc...

;Keep Systray Centered

*script var trayXpos $ResolutionX/2$


*script bang !Systray_Left
*script exec !varAdd trayXpos -9
*script exec !SystrayMove %{trayXpos} -25
*script ~bang

*script bang !Systray_Right
*script exec !varAdd trayXpos 9
*script exec !SystrayMove %{trayXpos} -25
*script ~bang


Tray is stuck in lower left corner after recycle. Adding or removing icons in tray does not move tray.

If I comment out the 4 lines of Syatray_Left, the tray starts with the left edge at center bottom (extended right). Adding icon does nothing...removing icon moves tray to lower left corner.

Posted by member 1 on 2004-04-11 13:12:33 link

*script exec !varAdd trayXpos 9

you need a + in there so you can actually do math.

Posted by member 7223 on 2004-04-11 18:56:33 link

Nobody ear about "systraycurrentx", "systraycurrenty", "systraycurrentwidth"...

Posted by member 17899 on 2004-04-11 20:09:12 link

+ sign makes no difference.... isn't that what !varAdd is supposed to do anyway....ADD?

Tried...

;*script var trayXpos $ResolutionX/2$


*script bang !Systray_Left
;*script exec !varAdd trayXpos -9
*script exec !SystrayMove $systraycurrentX$-9 -25
*script ~bang

*script bang !Systray_Right
;*script exec !varAdd trayXpos 9
*script exec !SystrayMove $systraycurrentX$+9 -25
*script ~bang


Result....Variable systraycurrentx not defined

Posted by member 35 on 2004-04-11 21:16:43 link

it's $systraycurrentX-9$ and $systraycurrentX+9$

Posted by member 17899 on 2004-04-11 21:21:08 link

same results either way :(

Variable systraycurrentx not defined

Posted by member 17899 on 2004-04-11 21:24:22 link

by the way...using systray2.dll here not Vtray

Posted by member 37809 on 2004-04-11 21:57:38 link

Evars weren't designed to be dynamic when evaluated.
Every time the number of icons changes, you want to !SystrayMove $(resolutionx-systraycurrentwidth)/2$ -30
but that won't work unless it's re-evaluated each time.
That is, when litestep reads the step.rc (and its includes)
it will interpret that and remember it as such. You'll even have to set SystrayCurrentWidth 0 before you use it since litestep's just doing its preprocessing as it should. Try
SystrayCurrentWidth 0
SystrayOnAdd !SystrayMove $(resolutionx-systraycurrentwidth)/2$ -30
SystrayOnDel !SystrayMove $(resolutionx-systraycurrentwidth)/2$ -30
SystrayCheckOnCommands

Note the SystrayCheckOnCommands setting.
You'll need that or you will need to load some module that provides an escape sequence for $ and an accompanying bang to parse that escape sequence used in a string (and execute the result).

...back to building my coffin

Posted by member 17899 on 2004-04-12 06:54:38 link

Now THAT works perfectly! :o) And no scripting needed!

Thanks very much to all who helped and especially to tnl for a working solution.

Rodger