box with a label crashes when hided! Thread last updated on 2003-07-01 12:23:33

Posted by member 1783 on 2003-06-15 03:43:18

i have a clock-label in an lsbox which can be displayed optionally and it's animated. i don't know when the bug came into the code cause before it worked perfectly. here's my code:
STEP.RC

LoadModule "$LiteStepDir$desktop2.dll"
LoadModule "$LiteStepDir$popup2.dll"
LoadModule "$LiteStepDir$hotkey.dll"
LoadModule "$LiteStepDir$shortcut2.dll"
LoadModule "$LiteStepDir$systray2.dll"
LoadModule "$ModulesDir$tasks.dll"
LoadModule "$ModulesDir$label.dll"
LoadModule "$ModulesDir$RabidVWM.dll"
LoadModule "$ModulesDir$lswchanger.dll"
LoadModule "$ModulesDir$lsbox.dll"
LoadModule "$ModulesDir$mzscript.dll"

ClockLabelText "[time('i:nn')]"
ClockLabelX 0
ClockLabelY 0
ClockLabelWidth 45
ClockLabelHeight 22
ClockLabelFont Tahoma
ClockLabelFontHeight 13
ClockLabelFontColor FFDE00
ClockLabelJustify center
ClockLabelOnLeftDoubleClick !execute [control.exe timedate.cpl]
ClockLabelTransparent

CLOCK.BOX

LsBoxName Clock
LsBoxX 2
LsBoxY -0
LsBoxHeight 22
LsBoxWidth 45
LsBoxBackground box_bg.png
LsBoxBackgroundOffs 1 1 1 1
LsBoxZOrder HUGBOTTOM

*ModuleHook !LabelLsBoxHook ClockLabel

SCRIPT.RC

*Script bang !Toggle_Clock
*Script gotoif ("%{Initialized}" = "false") Show_Clock
*Script gotoif ("%{ClockVisible}" = "true") Hide_Clock

*Script label Show_Clock
*Script exec !LsBoxCreate $ConfigDir$clock.box
*Script exec !ifEval ("%{Initialized}" = "false") {!LsBoxMoveBox Clock "%{ClockCurrentX}" "-24"} else {!Execute [!pause 500][!LsBoxMoveBox Clock "%{ClockCurrentX}" -24 10 20]} (this is one line)
*Script exec !varSet ClockVisible "true"
*Script goto Save_Clock

*Script label Hide_Clock
*Script exec !LsBoxMoveBox Clock "%{ClockCurrentX}" -0 10 20
*Script exec !ClockLabelDestroy
*Script exec !LsBoxDestroy Clock
*Script exec !varSet ClockVisible "false"

*Script label Save_Clock
*Script exec !varSave ClockVisible
*Script ~bang

when the theme is initialized !Toggle_Clock is called and Initialized=false. that way the box isn't animated when ls is loaded, but only when the !bang is called in the middle of the session.

the error occurs when !Toggle_Clock is called to hide the box. the box hides and then ls crashes (error has occured and program must be closed yada yada...)
strangely this happens only when the clock is loaded during the initialization process when ClockVisible=true. if it's false and !Toggle_Clock is called later to make the clock apper with the animation everything is fine and the hiding process runs without problems.

i know this must be something simple cause i've been sitting in front of the computer for hours and can't see the bug so please help me!

Posted by member 7223 on 2003-06-15 07:34:31 link

Perhaps it can be fix by removing the quotes surrounding %{ClockCurrentX} -24 in your !LsBoxMove call.

Posted by member 1783 on 2003-06-15 07:51:10 link

newp, no help :(

Posted by member 1783 on 2003-06-15 07:56:26 link

wow :)
i commented out the line where the box is killed and it stopped crashing. why? i still need to kill the box.

Posted by member 1783 on 2003-06-30 05:33:42 link

i degraded to latest "stable" build (9-02-2003) and it stopped crashing everytime. now it crashes only when i call the bang using lscp or lstm. when i call it via popup it works, but an error appears in the log:

06-30-2003 13:17:19 - Litestep: Exception in main thread message loop; hWnd = 0x90140; message = 0x202, classname = Re5ources_PopupMenu

also i'm still not able to make it appear again, cause then i'll get an error message:

"Box "Clock" not found!" from LsBox.

It's seem that killing the box is still the problem, cause the script stops there and !varSet won't occur.

so is there anybody who could translate that error to me?

Posted by member 1783 on 2003-06-30 08:58:35 link

another observation: if all the other boxes are unloaded this clock-box works perfectly, but if another box is visible during the unloading process the error occurs.

Posted by member 1783 on 2003-06-30 09:15:24 link

ok, and another discovery: i tried to change the loading order of the boxes:
*Script bang !Initialize
*Script exec !varSet Initialized "false"
*Script exec !varSave Initialized
*Script exec !ifEval ("%{ClockVisible}" = "true") !Toggle_Clock
*Script exec !ifEval ("%{VWMVisible}" = "true") !Toggle_VWM
*Script exec !ifEval ("%{AmpVisible}" = "true") !Toggle_Amp
*Script exec !ifEval ("%{TextVisible}" = "true") !Toggle_Text
*Script exec !ifEval ("%{TasksVisible}" = "true") !Toggle_Tasks
*Script exec !varSet Initialized "true"
*Script exec !varSave Initialized
*Script ~bang

the result was that the box which was loaded first created the error. the others worked fine.

now this is getting a little boring, cause i'm the only one who's helping me :D so please, any ideas how to fix this?

Posted by member 7 on 2003-06-30 14:25:30 link

Does this even happen if you use the 3.0 preview? iirc it's a known bug in 2.9x... though I could be wrong.

Posted by member 1783 on 2003-06-30 14:46:08 link

nope :) 3.0 fixed it. thnx ilmcuts ;)

Sadly that dropped the win9x support as i tried it out on my other computer. oh well, but what can you do about it :)

Posted by member 503 on 2003-07-01 09:35:25 link

Instead of using !ClockLabelDestroy, try !ClockLabelHide

Posted by member 1783 on 2003-07-01 12:23:33 link

wellll, but i really want to kill that label ;)
besides, it doesn't matter cause the box which is loaded first is buggy, whatever is in the box.