attach systray to taskbar Thread last updated on 2003-05-18 04:38:26

Posted by member 2112 on 2003-04-10 18:46:43

I'm using systray2.dll and taskbar3.dll in a theme. I want to have the systray resize automatically but if I do it will either overlap my taskbar or run off the side of my monitor. I'm looking for something that works like the standard windows shell where if the system tray grows it takes the space from the taskbar. Is this possible?

Posted by member 515 on 2003-04-10 21:14:41 link

To make taskbar resize when icons adds to systray :
SystrayOnAdd !TaskbarShrink 18 0
SystrayOnDel !TaskbarGrow 18 0


To set proper task bar width on start:
TaskbarWidth $resolutionx-SystrayCurrentWidth$


That works for me ...

Posted by member 2112 on 2003-04-11 00:21:24 link

That's exactly what I was looking for. Thanks.

Posted by member 515 on 2003-04-11 03:23:50 link

Your welcome .... ;)

Posted by member 1783 on 2003-04-12 11:45:25 link

chuvi, ya should post that trick in the code section ;)

Posted by member 602 on 2003-04-13 09:47:29 link

I think he should wait with it until it works with both a recycle and a refresh. There are some other issues with it too, but I won't be able to look at that since I'm away now for about 3 weeks.

Posted by member 7223 on 2003-04-14 03:36:49 link

I don't understand why it shouldn't works on recycle. Since there's a !Reload command, I guess there's no need to use !Refresh anymore. Then, I haven't try with !Refresh because many modules have to be reconfigured right after...

I guess the best way to use Systray/TaskbarOnAdd/Del is to load systray2.dll AFTER taskbar3.dll. Using script and !ReloadModule bangs should be helpfull instead of regular LoadModule rc settings

Posted by member 2112 on 2003-04-14 19:29:03 link

Umm... is it possible to do this with label.dll?

My layout has changed and I've filled a gap between winamp and the systray with a label containing only an image.

I have both the label and systray set to AlwaysOnTop and the systray is on the very top but if you click on the label it becomes on top. I want the label set to alwaysontop so programs don't overlap it.

Any tips?

Posted by member 7223 on 2003-04-14 21:04:00 link

DrWorm, I don't really understand what you want to do.
I think you want to resize your label when icons are add to the systray. If I'm right, you must use mzscript and define a var:

*Script start !VarSet trayitems
*Script start !ReloadModule "$LitestepDir$Systray2.dll"


SystrayOnAdd !Execute [!VarAdd trayitems 1][!Exec !VarSet tmp -%{trayitems}][!VarMul tmp $SystrayIconSize+SystrayIconSpacingX$][!VarAdd tmp $LabelWidth-SystrayBorderLeft-SystrayBorderRight$][!Exec !LabelResize %{tmp} $LabelHeight$]
SystrayOnDel !Execute [!VarAdd trayitems -1][!Exec !VarSet tmp -%{trayitems}][!VarMul tmp $SystrayIconSize+SystrayIconSpacingX$][!VarAdd tmp $LabelWidth-SystrayBorderLeft-SystrayBorderRight$][!Exec !LabelResize %{tmp} $LabelHeight$]

Quite simple, isn't it ?

Posted by member 99 on 2003-04-15 02:13:58 link

wow... too bad you can't just do something like:
SystrayOnAdd !VWMExec !LabelResize ^@#d^TotalWidth-SystrayCurrentWidth^@#d^ $LabelHeight$
SystrayOnDel !VWMExec !LabelResize ^@#d^TotalWidth-SystrayCurrentWidth^@#d^ $LabelHeight$
;)

Posted by member 1 on 2003-04-15 02:25:33 link

Quite simple, isn't it?

:p

Posted by member 7223 on 2003-04-15 03:07:57 link

Josh, I have to read the "Classics" again...
I didn't know I could test dynamic evars like that. It's an open door to everything.
If it works like I think, I will use it in scripts to check some dimensional evars. Life will be easier, now.

Posted by member 99 on 2003-04-15 03:53:33 link

Actually, I was waiting to see how you handled this :) It's quite good, I wouldn't have thought to calculate $SystrayCurrentWidth$ if it weren't there.

Posted by member 2112 on 2003-04-15 19:44:06 link

RabidCow's code isn't quite working. Let me show you what I have.

SystrayAlwaysOnTop true
SystrayAutoSize true

SystrayX -85
SystrayY -20
Systrayheight 20

SystrayDirection Left
SystrayWrapCount 0
SystrayIconSpacingX 2

SystrayBitmap systray.bmp
SystrayBGColor #FFFFFF
SystrayBorderColor #FF0000
SystrayBorderSize 1

SystrayBorderDrag false


Labels Divide04

Divide04X 736
Divide04Y -20
Divide04Width $resolutionX-SystrayCurrentWidth-Divide04X-20$
Divide04Height 20
Divide04Image label_divide.bmp
Divide04ImageLeftEdge 1
Divide04ImageRightEdge 1
Divide04ImageMode stretch
Divide04AlwaysOnTop


SystrayOnAdd !VWMExec !Divide04Resize ^@#d^TotalWidth-SystrayCurrentWidth^@#d^ $Divide04Height$
SystrayOnDel !VWMExec !Divide04Resize ^@#d^TotalWidth-SystrayCurrentWidth^@#d^ $Divide04Height$


I'm getting an error saying uninitialised variable SystrayCurrentWidth. I have the latest indiestep build dated 2003-02-09 and the systray2.dll is loaded.

Any ideas?

Posted by member 602 on 2003-04-16 04:36:00 link

Update! Skip this and read below!
This is because you can (should)have numbers inside the $...$ like $SystrayCurrentWidth-20$, but you can't have another evar inside an evar. So do it like this instead:

Divide04Width $ResolutionX-20$-$SystrayCurrentWidth$-$Divide04X$

This works for me.

And Smurth, about the recycle thing. A recycle works, but a refresh doesn't. This seems to be because systray.dll doesn't count the icons as beeing added on a refresh, and so the OnAdd/Del isn't executed. This will probably be fixed with later builds, but until then. And as I said there are some other issues if I remember correctly. I thought I should whip up a small tutorial on taskbar3 since there seem to be people having problems with it, and it will probably cover an autosizing systray. But I'll get back to that in a couple of weeks.

Posted by member 7223 on 2003-04-16 09:41:57 link

Milk, I frequently use things like:
$Evar1+Evar2)/Evar6+(Evar3*Evar4)/Evar5$
...and it's working as me (and everyone) expect it.

Posted by member 503 on 2003-04-16 10:05:02 link

Milk, I can't imagine why that would work for you. The entire expression must be inside of the $'s.

Posted by member 602 on 2003-04-16 10:07:06 link

Strange... That just wont work for me!

Update! I see my problem here. I thought there should be $'s around all evars. You learn something new everyday. My version still works for me though.

Posted by member 602 on 2003-04-16 11:07:50 link

AAHH!! blasted. Sorry guys, I'm probably mixing things up here since I haven't got access to litestep at the moment. DrWorm, the fix is as follows. Put this line right after you load your modules:
SystrayCurrentWidth 0


Otherwise, it's not initialized.

Posted by member 7223 on 2003-04-16 12:06:48 link

Milk, thanks for the tip; it could be usefull

Posted by member 602 on 2003-04-18 04:04:34 link

I got it from these forums, so it has worked for others to. But shouldn't systray2 initialize it when it is loaded? I'm no coder so I dont know but it whould be kind of great. Or is there some advantage of setting it by yourself, like if you want the tray to be some minimum width. But hey, you can still use SystrayWidth even with Autosize (and you should to make the positioning work smoothly) so why not let the current size be initialized to the width. I'd be happy if someone would clear this out for me.

Posted by member 7 on 2003-04-18 04:44:14 link

Step.rc parsing is done before modules are loaded. If step.rc wasn't parsed LS couldn't start looking for "LoadModule" lines. =) Hence modules can't initialize a var during the parsing process.

Posted by member 7223 on 2003-04-18 08:06:47 link

ilmcuts: you are our eye-opener

Posted by member 602 on 2003-04-18 10:27:17 link

A yes, thanx! But just about all settings have defaults. Can't CurrentWidth have a default 0 here, or is there a practical reason why it has to be set manually?

Posted by member 7 on 2003-04-18 14:01:47 link

Defaults are set by the modules when they request a setting. The core can't guess if it's a boolean, integer, or string variable.

Posted by member 602 on 2003-04-20 06:10:20 link

Yeah ok, well it's not a problem really. As long as it's mentioned somewhere at least, and I guess it will be in the new docs soon to come.

Posted by member 2112 on 2003-05-08 19:39:05 link

Thanks Milk. That removed the errors but the label Divide04 is still not the correct width. The results of Divide04Width $resolutionX-SystrayCurrentWidth-Divide04X-20$ are as if SystrayCurrentWidth is equal to 0. Maybe it is? When an icon is added or removed it has no effect. Any other ideas?

My code is still the same as above with the exception of adding SystrayCurrentWidth 0.

Posted by member 2112 on 2003-05-08 22:58:12 link

My bad.

All this time I never had TotalWidth defined. Only after I changed to RabidVWM did I get an error for it.

Posted by member 1783 on 2003-05-17 09:40:23 link

but the systrayCurrentWidth still stays 0 :(
i initialized it right after loading the module but it doesn't change. i want the systray to be in a box and i want the box to resize when the systray resizes.
STEP.RC

LoadModule "$LiteStepDir$systray2.dll"
SystrayCurrentWidth 0
LoadModule "$ModulesDir$lsbox.dll"

*LsBoxCreate "$ConfigDir$systray.box"

SystrayX 1
SystrayY 1
SystrayBGColor 000000
SystrayAutoSize true
SystrayOnAdd !LsBoxResize Systray $SystrayCurrentWidth+2$ 20
SystrayOnDel !LsBoxResize Systray $SystrayCurrentWidth+2$ 20

SYSTRAY.BOX

LsBoxName Systray
LsBoxX -120
LsBoxY -21
LsBoxWidth 20
LsBoxHeight 20
LsBoxBackGround box_bg.png
LsBoxBackgroundOffs 1 1 1 1

*ModuleHook !systrayHook

Posted by member 602 on 2003-05-17 10:42:22 link

Well I haven't ever used LSBox, but the readme for it says this:
!LsBoxResize blaa blaa blaa... This will have no effect on a box with a static background
I don't know what a static background is but I guess it means a box with a background image since thats where it gets its width and height unless defined. I guess if you don't define a background image for the box but for the systray instead it might work better.

Posted by member 1783 on 2003-05-17 11:14:52 link

yes, that might be a problem too, but SystrayCurrentWidth is still 0! I checked it with mzscript: after initializing, when there were 4 icons in the systray, systrayCurrentWidth was 0 tho it should have been 67, i think.

Posted by member 1783 on 2003-05-17 11:17:47 link

ok, the box can have a background image and be resizeable, it's width, height and border must be defined for thata and now they are.
i even can see the box's original size for a moment and then it shrinks to 2px width, cause SystrayCurrentWidth is 0.

Posted by member 562 on 2003-05-17 12:02:40 link

egonz, did you ever consider the quick and dirty way:
you create a fixed-size box of oversufficient length (to allow 15 or so systray icons) with an all-magicpink background - and you hook an autosizing systray in it. works for me (only win2k or winXP though)

Posted by member 1783 on 2003-05-17 13:39:53 link

hmm, that's one way to do it. and actually not a bad one. thnx ceeslans :)
i think i'll try it, but still i would like to know how to use SystrayCurrentWidth (you never know when it might come handy ;)

Posted by member 1783 on 2003-05-17 13:43:02 link

does anyone have a working example of SystrayCurrentWidth in action?

Posted by member 2112 on 2003-05-17 18:37:03 link

The code I posted above is a working example as long as you initialise SystrayCurrentWidth first and set a value for TotalWidth.

Posted by member 1783 on 2003-05-18 02:09:36 link

thnx, but maybe a theme where it's used? i would like to see the whole picture.

Posted by member 2112 on 2003-05-18 03:24:44 link

Posted by member 602 on 2003-05-18 04:22:01 link

Have you tried using systray without a box. Would be interesting to se if it worked then. Might be something with the hook. BTW it isn't that $tardock app takin over your systray I've read about in some threads.
I use SystrayCurrentWidth in my litescape theme, but not the versions posted here yet. However here's the code if it's any help to you.
; ===============================================
; S y s t r a y . d l l
; ===============================================
SystrayCheckOnCommands
SystrayOnAdd !TaskbarShrink 18 0
SystrayOnDel !TaskbarGrow 18 0
SystrayAutoSize
SystrayAlign right bottom
sysTrayX -82
sysTrayY -34
SystrayDirection Left
SystrayWidth 0
sysTrayIconSpacingX 2
SystrayIconSpacingY 0
SystrayBorderTop 8
SystrayBorderBottom 10
SystrayBitmapTiled
SystrayBitmap systray.bmp

Posted by member 1783 on 2003-05-18 04:38:26 link

no stardock in this system :) and i have tried using it without a box, but i think i'll stick to the box.

anyway, I DID IT!!! it's finally working :)
had to use RabidVWM to add the $-signs:
SystrayOnAdd !VWMExec !LsBoxResize Systray ^@#d^SystrayCurrentWidth+2^@#d^ 20
SystrayOnDel !VWMExec !LsBoxResize Systray ^@#d^SystrayCurrentWidth+2^@#d^ 20

thnx for the help everybody. i couldn't have done it without you ;)