Page 1 of 1

Handle error on function

Posted: Mon Feb 16, 2015 2:53 pm
by AlessioForconi
I'm trying to write a function to enable or disable certain controls depending on whether it receives the parameter to true or false, but I get this error.

"stack "Calcolo Ferie - ROL - Monte Ore": execution error at line 2 (Handler: can't find handler) near "EnableDisableControl", char 1"

Where am I wrong?

Code: Select all

on openStack
    EnableDisableControl true
    ##set the disabled of group "groupMainControls" to true
end openStack


function EnableDisableControl TrueFalse
    if TrueFalse = true then
        set the disabled of group "groupMainControls" to true
    else
        set the disabled of group "groupMainControls" to false
     end if
end EnableDisableControl
Thanks

Re: Handle error on function

Posted: Mon Feb 16, 2015 2:56 pm
by Klaus
Buongiorno Alessio,

well, LC is definitively correct, you do not have a HANDLER named "EnableDisableControl"! 8)
Hint: Handler start with "command" in contrary to a erm... function. Get it? :D


Best

Klaus

Re: Handle error on function

Posted: Mon Feb 16, 2015 3:05 pm
by WaltBrown
There's a note in the Dictionary entry on "openStack". It says to put functions you want to run once into the first card of the stack instead of the stack script. This worked when I tested your code. You may want to read about message paths in http://lessons.runrev.com/m/4603/l/4403 ... ssage-path.

I also had to change the line to "get EnableDisableControl(true)"

Walt