Page 1 of 1
Can't find handler
Posted: Thu Apr 16, 2009 8:47 pm
by pwr
Hi, I'm new to Revolution and have the following problem with my first app.
I have a single stack and a single card in my app. There are several controls on my card.
I've created a custom handler named ConvertUnits that I placed in my stack script. However, when I try to execute the handler using keyUp on a field I get the "can't find handler" error msg.
Funny though, if I right-click on the ConvertUnits command and select the "Go to definition" it finds the handler with no problem. There are no compile errors.
I read elsewhere on this forum that it may be better to create the custom handler before you write the command to execute it, and I may not have done this. But certainly, the Rev product must be able to see the handler after it's written!!!!
Why can't I find my handler....????
Re: Can't find handler
Posted: Thu Apr 16, 2009 8:55 pm
by sturgis
Mind posting the handler code and your field code?
Lots of times when you get that error it is actually something missing in the lines above the call, but if you post the code it'll be easier to find whats up.
pwr wrote:Hi, I'm new to Revolution and have the following problem with my first app.
I have a single stack and a single card in my app. There are several controls on my card.
I've created a custom handler named ConvertUnits that I placed in my stack script. However, when I try to execute the handler using keyUp on a field I get the "can't find handler" error msg.
Funny though, if I right-click on the ConvertUnits command and select the "Go to definition" it finds the handler with no problem. There are no compile errors.
I read elsewhere on this forum that it may be better to create the custom handler before you write the command to execute it, and I may not have done this. But certainly, the Rev product must be able to see the handler after it's written!!!!
Why can't I find my handler....????
Posted: Thu Apr 16, 2009 9:01 pm
by pwr
Here's the custom handler in my stack script...
function ConvertUnits
switch
case the value of SelectedProperty is "Area"
ConvertAreas --Not yet done
break
case the value of SelectedProperty is "Length"
break
case the value of SelectedProperty is "Temperature"
ConvertTemperatures
break
end switch
end ConvertUnits
Here's my call to the custom handler...
on keyUp
if the text of field fldInputValue is not a number then beep
else --pass keyDown
ConvertUnits
end if
end keyUp
Thanks for any help...
Posted: Thu Apr 16, 2009 9:50 pm
by sturgis
Edited to correct: Since you've defined it as a function try adding () at the end to make the call ConvertUnits().
In addition, you can change it from a function to a command and forget the parens entirely.
Think you can also shorten the typing requirements for your switch /case block if you wish.
YOu can do something like this to avoid retyping SelectedProperty so much. (yes i'm lazy)
Code: Select all
switch the value of SelectedProperty
case "Area"
code here
exit switch -- or break
case "Length"
code here
exit switch
case "Temperature"
code here
exit switch
default
answer "No match"
end switch
[/b]
pwr wrote:Here's the custom handler in my stack script...
function ConvertUnits
switch
case the value of SelectedProperty is "Area"
ConvertAreas --Not yet done
break
case the value of SelectedProperty is "Length"
break
case the value of SelectedProperty is "Temperature"
ConvertTemperatures
break
end switch
end ConvertUnits
Here's my call to the custom handler...
on keyUp
if the text of field fldInputValue is not a number then beep
else --pass keyDown
ConvertUnits
end if
end keyUp
Thanks for any help...
Posted: Thu Apr 16, 2009 11:01 pm
by pwr
Thank you very much.
I changed my function to a command and now it's working.
Again, thanks very, very much...pwr