Simplifying xLabel instructions Thread last updated on 2006-12-17 16:38:07

Posted by member 348804 on 2006-12-17 13:42:20

I am drawing a row of icons as a sort of a quicklaunch. Below is the .rc file for the launchbar. I am only showing the first 3 entires, but currently it is replicated 12 times. I am wondering if there is a way to simplify the replication?

Peter

;------------------------------------------------------------------------------
; pl0 row
;------------------------------------------------------------------------------
pl0Height 64
pl0Width 64
pl0Alphamap
pl0Y $ResolutionY-105$
pl0ExtractIconSize 64
pl0BalloonToolTip



;------------------------------------------------------------------------------
; pl01 button
;------------------------------------------------------------------------------
*label pl01_
pl01_AddToGroup pl0
pl01x $mainbarleftx+200$
pl01_X $pl01x$
pl01_Image "$LSImageFolder$launch\computer.ico"
pl01_OnLeftClick "$drives$"
pl01_ToolTip "My Computer"
pl01_OnEnter !LabelReposition pl01_ $pl01x-4$ $pl0y-4$ 72 72
pl01_OnLeave !LabelReposition pl01_ $pl01x$ $pl0y$ 64 64

;------------------------------------------------------------------------------
; pl02 button
;------------------------------------------------------------------------------
*label pl02_
pl02_AddToGroup pl0
pl02_X $pl02_X+70$
pl02_Image "$LSImageFolder$launch\documents.ico"
pl02_OnLeftClick "$FileManager$"
pl02_ToolTip "My Documents"
pl02_OnEnter !LabelReposition pl02_ $pl02x-4$ $pl0y-4$ 72 72
pl02_OnLeave !LabelReposition pl02_ $pl02x$ $pl0y$ 64 64

;------------------------------------------------------------------------------
; pl03 button
;------------------------------------------------------------------------------
*label pl03_
pl03_AddToGroup pl0
pl03_X $pl02_X+70$
pl03_Image $browser$
pl03_OnLeftClick !execute ["$browser$"]
pl03_ToolTip "My Computer"
pl03_OnEnter !LabelReposition pl03_ $pl03x-4$ $pl0y-4$ 72 72
pl03_OnLeave !LabelReposition pl03_ $pl03x$ $pl0y$ 64 64

Posted by member 5575 on 2006-12-17 14:43:32 link

Cerbie would tell you to use lua.

Posted by member 212670 on 2006-12-17 14:44:58 link

(edited)

You can probably put the OnEnter/Leave in the group, using !LabelRepositionBy instead of !LabelReposition, since it looks like they're all doing the same thing. Something like...

pl0OnEnter !ParseEvars !LabelRepositionBy %[LabelName]% -4 -4 72 72
pl0OnLeave !ParseEvars !LabelRepositionBy %[LabelName]% 4 4 64 64

Posted by member 348804 on 2006-12-17 15:37:09 link

Perfect LabelRepositionBy worked just fine...I was thinking of that bang, but I didn't know the %[LabelName]% option.

Just a minor note, LabelRepositionBy uses relative cx cy values, so
-4 -4 8 8 makes it grow from 64 to 72

Peter

Posted by member 12025 on 2006-12-17 16:28:59 link

Nah, I'd recommend Lua for creating them in the first place ;). With so many static settings, xcal's way is far better.

Posted by member 348804 on 2006-12-17 16:38:07 link

As I develop this theme, eventually I think they will become vars with drag and drop support, but I'm not sure on that yet.

It's fun developing this theme for me, but it doesn't pay the bills :(

Peter