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?
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 ...
That's exactly what I was looking for. Thanks.
chuvi, ya should post that trick in the code section ;)
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.
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
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?
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 ?
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$
;)
Quite simple, isn't it?
:p
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.
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.
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?
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.
Milk, I frequently use things like:
$Evar1+Evar2)/Evar6+(Evar3*Evar4)/Evar5$
...and it's working as me (and everyone) expect it.
Milk, I can't imagine why that would work for you. The entire expression must be inside of the $'s.
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.
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.
Milk, thanks for the tip; it could be usefull
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.
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.
ilmcuts: you are our eye-opener
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?
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.
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.
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.
My bad.
All this time I never had TotalWidth defined. Only after I changed to RabidVWM did I get an error for it.
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
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.
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.
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.
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)
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 ;)
does anyone have a working example of SystrayCurrentWidth in action?
The code I posted above is a working example as long as you initialise SystrayCurrentWidth first and set a value for TotalWidth.
thnx, but maybe a theme where it's used? i would like to see the whole picture.
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
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 ;)