Handle error on function

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
AlessioForconi
Posts: 90
Joined: Sun Feb 15, 2015 2:51 pm

Handle error on function

Post by AlessioForconi » Mon Feb 16, 2015 2:53 pm

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
Last edited by AlessioForconi on Mon Feb 16, 2015 7:47 pm, edited 1 time in total.

Klaus
Posts: 14199
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Handle error on function

Post by Klaus » Mon Feb 16, 2015 2:56 pm

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

WaltBrown
Posts: 466
Joined: Mon May 11, 2009 9:12 pm

Re: Handle error on function

Post by WaltBrown » Mon Feb 16, 2015 3:05 pm

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
Walt Brown
Omnis traductor traditor

Post Reply