Making my first theme Thread last updated on 2004-07-29 17:26:04

Posted by member 108633 on 2004-07-27 20:55:08

Im making a theme, and I've run into a problem that I hope you guys can help me fix. I have a button(Labelbutton) and it toggles Labelpopup to show up on the screen. Labelpopup is hidden at theme startup and I want Labelbutton to toggle it on and off. When its off I want Labelbutton to toggle it on, and when its on I want Labelbutton to toggle it off. I don't know how to change the Labelbutton commands while in mid-theme. Heres what I got so far.
IF LabelpopupHidden
LabelbuttonOnLeftClick !execute[!Labelpopupshow]
ELSE
LabelbuttonOnLeftClick !execute[!Labelpopuphide]
END IF

Thanks in advance.

Posted by member 12798 on 2004-07-27 21:12:58 link

use mzscript:
LabelbuttonOnLeftClick !switchlabelpopup

*script start !varset labelpopuphidden true

*script bang !switchlabelpopup
*script exec !ifeval ("%{labelpopuphidden}" = "true") {!Labelpopupshow} else {!Labelpopuphide}
*script ~bang

...should work, although it might fail because i'm not aware of everything right now ;)

first line into any .rc, the others in a mzscript file (this means you set *mzscriptfile somewhere, for example in your theme.rc).

Posted by member 12025 on 2004-07-27 21:29:42 link

To elaborate for you, those RC settings are only read when doing a !recycle or !reload, so you need mzScript for minor run-time things like that.

Posted by member 37809 on 2004-07-27 21:35:05 link

See http://www.litestep.net/index.php?section=4&action=view&catId=7&id=2057

If it's xLabel you're using and its a recent build you can probably do this without mzscript but the principle with toggling a boolean is the same.

Posted by member 108633 on 2004-07-27 21:51:35 link

It doesnt work.
Theme.rc
include "$ConfigDir$taskbar.rc"
include "$ConfigDir$label.rc"
include "$configDir$vtray.rc"
mzScriptFile "$ConfigDir$script.rc"

Script.rc
*script start !varset labelpopuphidden true

*script bang !switchlabelpopup
*script exec !ifeval ("%{labelpopuphidden}" = "true") {!Labelpopupshow} else {!Labelpopuphide}
*script ~bang

Label.rc
Labelbuttonimage $LSImageFolder$buttonbgtop.bmp
LabelbuttonX 70
LabelbuttonY -30
LabelbuttonWidth 26
LabelbuttonHeight 14
LabelbuttonOnLeftClick !switchlabelpopup

Labelpopupimage $LSImageFolder$popup.bmp
LabelpopupX 70
LabelpopupY -93
LabelpopupWidth 25
LabelpopupHeight 63
LabelpopupOnLeftClick !execute [!taskbarshow] [!labelclockshow] [!labeldateshow] [!labelbuttonshow] [!labelbutton2show] [!vtrayshow] [!jDeskSetWorkArea "0,0,-0,-0"] [!labelbutton3hide]
LabelpopupStartHidden


Can someone tell me what I'm doing wrong, I'm clueless.

Posted by member 12798 on 2004-07-27 22:12:43 link

it must be *mzscriptfile (with a leading star) i think

Posted by member 12025 on 2004-07-27 22:23:06 link

May this will be easier to follow:
*script start !varSet labelpopuphidden true

*script bang !labelpopupswitchstates
*script exec !IfEq labelpopuphidden "false" {!labelpopup_hide_it} else {!labelpopup_show_it}
*script ~bang
*script bang !labelpopup_hide_it
*script exec !labelpopuphide
*script exec !varSet labelpopuphidden true
*script ~bang
*script bang !labelpopup_show_it
*script exec !labelpopupshow
*script exec !varSet labelpopuphidden false
*script ~bang


...however, reading the OP again, um, this should do it, assuming you're using xLabel/xLabelLight:
LabelButtonOnLeftClick !LabelToggle LabelPopup

!LabelPopupToggle for label (up to 1.99).

If you aren't using xLabel, add this line to your theme.rc, and start!
*NetLoadModuleSite "http://www.ls-universe.info/download/modules/"

Posted by member 108633 on 2004-07-27 22:43:37 link

k thanks

Posted by member 108633 on 2004-07-27 22:52:13 link

I got another unrelated problem with my theme. The taskbar runs right into they systray. How can I stop this?

taskbar.rc
TaskbarPositioning True
TaskbarX 96
TaskbarY -30
TaskbarWidth $ResolutionX$-96-$systraywidth$
TaskBarHeight 30
TaskbarMaxTaskWidth 160
TaskbarButtonDirection .right
TaskbarNoSkinShift True
TaskbarSkinCenter $LSImageFolder$taskbg.bmp
TaskbarNormalSkinCenter $LSImageFolder$tasks.bmp
TaskbarNormalSkinLeft $LSImageFolder$tasks.bmp
TaskbarNormalSkinRight $LSImageFolder$tasks.bmp
TaskbarMinimizedSkinCenter $LSImageFolder$tasks.bmp
TaskbarMinimizedSkinLeft $LSImageFolder$tasks.bmp
TaskbarMinimizedSkinRight $LSImageFolder$tasks.bmp
TaskbarActiveSkinCenter $LSImageFolder$taskselect.bmp
TaskbarActiveSkinLeft $LSImageFolder$taskselectleft.bmp
TaskbarActiveSkinRight $LSImageFolder$taskselectright.bmp
TaskbarFlashingSkinCenter $LSImageFolder$tasks.bmp
TaskbarFlashingSkinLeft $LSImageFolder$tasks.bmp
TaskbarFlashingSkinRight $LSImageFolder$tasks.bmp
TaskbarTextShow True
TaskbarHorizontalTextAlign .left
TaskbarVerticalTextAlign .center
TaskbarNormalFontBold True
TaskbarActiveFontBold True
TaskbarMinimizedFontBold True
TaskbarFlashingFontBold True
TaskbarActiveFontColor 202020
TaskbarFlashingFontColor 5484B8
TaskbarNormalFontFace "Tahoma"
TaskbarNormalFontHeight 13
TaskbarNoFontShift
TaskbarNormalFontColor 202020
TaskbarMinimizedFontColor 56657C
TaskbarBorder 1 2 4 2
TaskbarButtonBorder 4 4 2 4
TaskbarButtonTextBorder 5 0 0 0
TaskbarSpacing 4
TaskbarIconShow True
TaskbarIconSize 14
TaskbarIconX 0
TaskbarIconY -1
TaskbarDisableFlashing False
;TaskbarAlwaysOnTop
TaskbarRButtonUp !PopupCommandTasks
TaskbarRefresh 100
TaskbarFlashScrollLock False
TaskbarUseToolTips True


vtray.rc
VTraySettingsCompatibility

SystrayAutosize
SystrayAlwaysOnTop true
SystrayX -2
SystrayY -35
SystrayIconSize 16
SystrayIconSpacingX 2
SystrayIconSpacingY 2
SystrayWidth 2
SystrayHeight 30

SystrayDirection left
SystrayWrapCount 10
SystrayWrapDirection up

SystrayBitmap $LSImageFolder$tray.bmp


Any suggestions?

Posted by member 12798 on 2004-07-28 05:32:07 link

doh, my script didn't work as it didn't switch anything at all :/
well, sorry hen, has been way too late yesterday ;)

should have been:
*script exec !ifeval ("%{labelpopuphidden}" = "true") {!execute [!Labelpopupshow][!varset labelpopuphidden false]} else {!execute [!Labelpopuphide][!varset labelpopuphidden false]}

Posted by member 103254 on 2004-07-28 09:13:14 link

here's something for your autosizing taskbar/systray:

VTrayOnAdd !TaskbarShrink 18 0
VTrayOnDel !TaskbarGrow 18 0

it will screw up if you have more that 10 icons because of your wrap settings. Damn, if I knew scripting, I could make something to make it work, but I don't =\

Question to mzscipters: can you use a something like that "SystrayOnAdd" setting in a script?

I'll go read mzscipt docs now :o Is there another resource I should read?

Posted by member 12025 on 2004-07-28 13:04:05 link

Not really, but look at themese that use reasonably simple scripts, like Pandora, slick, etc.

Also, there's a feature that, while documented technically, isn't well documented for mzScript. You can pass parameters. Now, there are two other tricks here that could help you out. Environment variables weren't meant to be used as anything but read-only values from a text file.

1. make the *mzVarFile themevars.rc, and put all variables in there. So here's what happens:
-LS loads, reads evars, including themevars.rc. No manipulation available.
-MzScript loads, reads themevars.rc for variables. The evars and mzScript vars match at this point.
-MzScript can alter its variables with scripts.
-You recycle or quit (theme change/shutdown/logoff/ included) LS, and the mzScript vars are saved to themevars.rc, so the evars are the right values when it loads next time.

Also, mzScript scripts can take parameters, but it isn't well documented (last I saw, it was only mentioned in the changelog).
So you can make a script, when calling the bang,
!randombang hey how are you

This then goes to script, and "hey" is \1, "how" is \2, etc. So you can use !IfEq \2 "hey" {!bangs} or set something as %{\2}misc, etc..
One caution: calling another scripted bang clears these parameters, so if you want to do that, save them to some variables first.

Some of that might be a bit over your head right now, but it comes in handy quite a bit.

Posted by member 108633 on 2004-07-28 13:10:27 link

Thanks, but it doesnt work. Heres a screenshot.

http://img69.exs.cx/img69/5479/error.png

My stupid graphics editor, ignore the black around the edges.

Posted by member 103254 on 2004-07-28 15:59:03 link

cerbie: thanks. Another question, can you use negative values with !varadd, to subtract? and values such as 0.5 with !varmul (to divide)?

ross: oops, my bad, probably should have been

SystrayOnAdd !TaskbarShrink 18 0
SystrayOnDel !TaskbarGrow 18 0

If it still doesn't work, what modules are you using for taskbar and systray?

Posted by member 103254 on 2004-07-28 18:05:57 link

Now, using the above code, it would work fine until your systray would wrap. Then, your systray wouldn't get wider (only higher), but your taskbar would still het narrower, I think you get the idea. But I spent a few hours reading mzscript docs, coding and testing, and here it is, my first script ;)

What it does is make sure your taskbar doesn't get narrower once your systray doesn't get wider.

Set this variable in your mzVarFile:

"sticons" "0"


and put this in your mzScriptFile:

*Script bang !stadd
*Script exec !varadd sticons 1
*Script exec !ifeval ("%{sticons}" < "%#SystrayWrapCount+1%#") '!taskbarshrink 18 0'
*Script ~bang

*Script bang !stdel
*Script exec !varadd sticons -1
*Script exec !ifeval ("%{sticons}" < "%#SystrayWrapCount%#") '!taskbargrow 18 0'
*Script ~bang


In any included rc file, add

SystrayOnAdd !stadd
SystrayOnDel !stdel



Should work no matter what your SystrayWrapCount is, except 0, which is default and unlimited. Then everything will get screwed up. If you use a non-wrapping systray, do not use this script. Use only the code in my last post

Posted by member 108633 on 2004-07-28 20:16:21 link

k, I didnt know how to make it never wrap, so I just put 10. I'm testing it now to see if it will work.

Posted by member 108633 on 2004-07-28 20:18:25 link

It still doesnt work and I'm using vtray-1.06 and taskbar3-0.306_alpha-3. And I switched the wrap count to 0.

Posted by member 103254 on 2004-07-28 20:46:02 link

Modify these settings, recycle, and see if it works.

TaskbarWidth $ResolutionX-98$

note that the -98 part is within the $ characters (wasn't in your original config).

remove the systraywidth setting, as it will autosize.

Posted by member 108633 on 2004-07-28 23:58:33 link

Now the systray doesnt show.

Posted by member 12025 on 2004-07-29 02:39:04 link

!varAdd -%{varname}
Dividing is a bit different. You need to use escape codes. Mainly %#, which becomes $. As you may know, evars can do some math. $5/10$ becomes 0.5. Trouble is that it really becomes 0.
*script exec !varMul %#1/%{varname}%#[code]If you're sure it will be an integer. Otherwise, maybe try[code]!varSet varname %#%{var1}/%{var2}%#
. That should do as follows, assuming 40 and 12:
-expand to %#40/12%#
-replace escape codes to $40/12$
-evaluate to 3.

FLoating point values are quite different. I'll be doing something for my next theme tomorrow, and will update with a working script for such things, as I'm about escape-coded out already, tonight :).

Posted by member 108633 on 2004-07-29 11:15:37 link

K that problem is fixed thanks to switching to systray2.dll and changing the TaskbarWidth entry to '$ResolutionX-SystrayCurrentWidth-96$'. Now I got a newer smaller problem. I need the systray to Autosize but also have a height of 30 all the time. But the SystrayHeight entry is ignored due to the SystrayAutosize entry. How do I fix this? Heres a screenshot. http://img62.exs.cx/img62/2513/error2.png

Sorry for all the questions. This should be the last one, I promise. And thanks for your help thus far.

Posted by member 108633 on 2004-07-29 12:18:56 link

Nevermind, I fixed it by adding these lines.
SystrayBorderTop 5
SystrayBorderBottom 5


Thanks for your help everyone!

Posted by member 108633 on 2004-07-29 17:26:04 link