1

Topic: synchronization xtray and label

system:win7 64 bit
as shown,when normal, Startbutton should have been left of the xtray
normal

Now is that theme loaded the Startbutton will automatically move one cell to the right every few seconds, meaning that automate xTrayOnRemove command.
normal

here is code:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
theme.rc:


xTrayX  -0
xTrayY  -128
xTrayAutoSize true
xTrayAutoSize  25 5
IF trayON
  xTrayStartHidden  false
ELSE
  xTrayStartHidden  true
ENDIF
xTrayAlphaMap
xTrayAlwaysOnTop
xTrayBorders  4 10 10 102
xTrayXSpacing  4
xTrayDirection  ".left"
;xTrayWrapDirection  ".bottom "
xTrayShowTooltip  false
xTrayPaintingMode  ".image"
xTrayImage  trayBackgroundWhite.png
xTrayImageTopEdge  22
xTrayOnMove  !movexTray
xTrayOnMiddleClickUp  !xTrayToggleHiddenIcons
xTrayOnAdd  !trayIconAdded
xTrayOnRemove  !trayIconRemoved
;xTrayOnAdd        !execute [!If ["%{trayOn}" = "true"] [!LabelMoveBy startButton -20 0 25 5]]
;xTrayOnRemove        !execute [!If ["%{trayOn}" = "true"] [!LabelMoveBy startButton 20 0 25 5]]
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
script.rc:

*Script bang !trayOn
  *Script exec  !xTrayShow
  *Script exec  !LabelMoveBy startButton %#-xTrayCurrentWidth%# 0 25 5
  *Script exec  !varset trayOn true
  *Script exec  !varsave trayOn
  *Script exec  !PopupRescan reload
*Script ~bang

*Script bang !trayOff
  *Script exec  !LabelMove startButton -103 -128 25 5
  *Script exec  !xTrayHide
  *Script exec  !varset trayOn false
  *Script exec  !varsave trayOn
  *Script exec  !PopupRescan reload
*Script ~bang

*Script bang !trayIconAdded
  *Script exec  !If ["%{trayOn}" = "true"] [!LabelMoveBy startButton -20 0 25 5]
*Script ~bang

*Script bang !trayIconRemoved
  *Script exec  !If ["%{trayOn}" = "true"] [!LabelMoveBy startButton 20 0 25 5]
*Script ~bang

*Script bang !movexTray
  *Script exec  !varset xTrayCurrentWidth %#xTrayCurrentWidth%#
  *Script exec  !varsave xTrayCurrentWidth
*Script ~bang
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
themeVars.rc

colourScheme  1
transparentOn  true
runDialogCoordinateX  1266
runDialogCoordinateY  646
shutdownDialogCoordinateX  1287
shutdownDialogCoordinateY  227
ampON  true
ampCoordinateX  50
ampCoordinateY  564
ampDockedOn  true
startMenuOn  true
trayOn  true
volumeOn  true
timeMode  1
dateMode  1
clockCoordinateX  787
clockCoordinateY  473
clockDockedOn  true
taskbarGroupingOn  false
xTrayCurrentWidth  330
;xTrayCurrentHeigh   200

2

Re: synchronization xtray and label

1 - What do you think of using "!ParseEvars" instead of scripts? (I'm assuming you use xlabel-4.3)

2 -

xTrayX  -0

There is not a negative zero. Is there any reason for this?

3 -

xTrayAutoSize true
xTrayOnAdd  !trayIconAdded
xTrayOnRemove  !trayIconRemoved

If you use Auto-resize, then you agree with me that every time an icon is added or removed from the tray, it changes? Then you can use:

xTrayOnResize !ParseEvars !LabelMove startButton %#xTrayCurrentX-startButtonWidth%# 0

3

Re: synchronization xtray and label

Thank you very much.
"xTrayX  -0" so Tray bar close to the right .
and Your code is very effective , I changed it to " xTrayOnResize !ParseEvars !LabelMove startButton %#xTrayCurrentX-startButtonWidth%# %#startButtonCurrentY%#" ,than "xTrayOnAdd" and  "xTrayOnRemove" more simple and effective , I very much like it,Solve a problem that bothers me a long time , although I still do not understand why .

4

Re: synchronization xtray and label

*Script exec  !LabelMoveBy startButton %#-xTrayCurrentWidth%# 0 25 5

I'll explain the problem soon. I'm at work now. But it's basically a math problem.

5

Re: synchronization xtray and label

         y                 y
         |                  |
x--------3------------------1---------------------------------
         | (xLabel)         | (xTray)                         |
          ------------------ ---------------------------------
        >|  -------2------  |<

1=xTrayX(xTrayCurrentX)
2=(xLabelName)Width
3=xTrayCurrentX-(xLabelName)Width

I hope you have understood. big_smile

6 (edited by conlin 2012-07-07 10:01:49 am)

Re: synchronization xtray and label

Yes, I understood when I got your code.
I do not understand is why "xtrayRemove"there is a problem , I think this is win7 64 bit system , for some reason ( virus or multi-threaded program, etc. ) , the " xtrayRemove " senses to the tray exception . Anyway , thank you .

7

Re: synchronization xtray and label

Ok, the important thing is that it worked. Good luck

8

Re: synchronization xtray and label

DiamondXplosion wrote:

1 - What do you think of using "!ParseEvars" instead of scripts? (I'm assuming you use xlabel-4.3)

2 -

xTrayX  -0

There is not a negative zero. Is there any reason for this?

In other words: In this instance, a positive X value calculates the distance from the left side of the screen. A negative X value calculates the distance from the right side of the screen. I do believe this is a feature coded uniquely to the xModules, but I could be wrong.

So, it's valid, but I prefer to use xTrayX $ResolutionX$. Similarly, If I wanted to position something 10 px from the right side, I'd do $ResolutionX-10$. I do this to specifically avoid using negative numbers (and thus causing this kind of confusion).

9

Re: synchronization xtray and label

Yes...please...please...always operate in positive numbers.  Those of us with multiple monitors implore you to please use the math instead of going with negative anything...unless...you do everything in negative.