Handlers not found in card script

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

xoolonite
Posts: 11
Joined: Thu Jan 15, 2015 6:25 pm

Handlers not found in card script

Post by xoolonite » Thu Feb 05, 2015 4:09 pm

Error message:

executing at 10:57:32 AM
Type Handler: can't find handler
Object group id 1030
Line numberPressed the short name of the target
Hint numberPressed


Have checked all scripts and unable to determine problem. Spelling correct and new handler added to card script. Have the latest version of Livecode and no errors shown when script applied. Following tutorial as far as I know accurately, the new handlers not showing in code window dropdown.

Any clues?

Martin

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Handlers not found in card script

Post by Klaus » Thu Feb 05, 2015 4:24 pm

Hi Martin,

1. welcome to the forum! :D

2. "numberPressed" is not a build-in Livecode command or function!
Did you create a handler or function with this name in the card script?
If not, what exactly do you want to do?
Please provide more info, maybe post the complete script(s) and an explanation about the "layout" of your objects, thanks.

To learn more about the basics of Livecode, I recommend to check these great stacks:
http://www.hyperactivesw.com/revscriptc ... ences.html


Best

Klaus

xoolonite
Posts: 11
Joined: Thu Jan 15, 2015 6:25 pm

Re: Handlers not found in card script

Post by xoolonite » Thu Feb 05, 2015 4:37 pm

Hi Klaus,

This is in the Livecode Course for building the Calculator app. Here is the card script: In the window I don't see the added handler option. I have tried assiging the handler to the group for the number objects in the calculator. Does this make sense?

local lCurrentOperator

local lCurrentOperator

on operatorPressed pOperator
if lCurrentOperator is not empty then
set the showborder of button lCurrentOperator to false
end if
--Set the border color to Black
set the borderColor of button pOperator to black
set the showBorder of button pOperator to true

put pOperator into lCurrentOperator

end operatorPressed

on numberPressed pNumPress
put pNumPress after field "display"
end numberPressed

on percentPressed
put field "display" into tCurrentValue
put tcurrentvalue / 100 into field "display"
end percentPressed

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Handlers not found in card script

Post by Klaus » Thu Feb 05, 2015 5:26 pm

Hi Martin,

hm, if this is in the card script then all object scripts on this card should be able to access it!?
Sorry, no brilliant idea in the moment...

Does it work if you create a new button on the card with:

Code: Select all

on mouseup
  numberPressed the short name of me
end mosueup
?

Best

Klaus

xoolonite
Posts: 11
Joined: Thu Jan 15, 2015 6:25 pm

Re: Handlers not found in card script

Post by xoolonite » Thu Feb 05, 2015 6:21 pm

if I interchange "number" with "operator" its works as expected on the same card??
on mouseUp
operatorPressed the short name of me
end mouseUp

on mouseUp
numberPressed the short name of me
end mouseUp

Klaus
Posts: 13829
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Handlers not found in card script

Post by Klaus » Thu Feb 05, 2015 6:25 pm

Hm, SHOULD work! 8)
Sorry, no idea...

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: Handlers not found in card script

Post by dave.kilroy » Thu Feb 05, 2015 6:47 pm

Hi Martin - does numberPressed appear in the left-hand pane of the script editor like this?
Attachments
Screen Shot 2015-02-05 at 17.45.35.png
"...this is not the code you are looking for..."

anmldr
Posts: 459
Joined: Tue Sep 11, 2012 11:13 pm

Re: Handlers not found in card script

Post by anmldr » Thu Feb 05, 2015 10:57 pm

Martin--

You can in fact get great help in this forum. However, you should look for the "Create it With LiveCode" forum where most of us have/are posting. If you don't have access--it is one of the private forums--then check with RunRev about gaining access.

Hope to see you there.
Linda

xoolonite
Posts: 11
Joined: Thu Jan 15, 2015 6:25 pm

Re: Handlers not found in card script

Post by xoolonite » Thu Feb 05, 2015 11:51 pm

Hi Dave,

The handlers are not showing in the left hand list and I have tried to find out why! When adding to card script they are not saving??
Is there an edit mode that needs switching on?

Thks

Martin

xoolonite
Posts: 11
Joined: Thu Jan 15, 2015 6:25 pm

Re: Handlers not found in card script

Post by xoolonite » Thu Feb 05, 2015 11:53 pm

anmldr wrote:Martin--have found this now and will post in future to the private forum.

Thks Linda.

You can in fact get great help in this forum. However, you should look for the "Create it With LiveCode" forum where most of us have/are posting. If you don't have access--it is one of the private forums--then check with RunRev about gaining access.

Hope to see you there.
Linda

xoolonite
Posts: 11
Joined: Thu Jan 15, 2015 6:25 pm

Re: Handlers not found in card script

Post by xoolonite » Thu Feb 05, 2015 11:54 pm

dave.kilroy wrote:Hi Martin - does numberPressed appear in the left-hand pane of the script editor like this?
Hi Dave,

The handlers are not showing in the left hand list and I have tried to find out why! When adding to card script they are not saving??
Is there an edit mode that needs switching on?

Thks

Martin

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: Handlers not found in card script

Post by dave.kilroy » Fri Feb 06, 2015 12:08 am

Aha! Good we are getting somewhere...

If handlers are not appearing on the left then I think there is a bug in the card's script which is preventing it from compiling

Probably the best way to find the bug is to comment out all the handlers except one and hit compile - if the one un-commented handler now appears in the left you know that the script compiled and that the bug is not in that particular handler. Next uncomment another handler, compile, check in the left - and continue until you get all the handlers in the left disappearing again (which means you've hit the bug). Once you get this you will know the bug is in that handler. After you've identified the buggy handler carry out a similar commenting/uncommenting process to find the source of the problem

Good luck! It shouldn't take you more than a few minutes to sort out - if you get stuck then upload the stack here...

Dave
"...this is not the code you are looking for..."

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: Handlers not found in card script

Post by dave.kilroy » Fri Feb 06, 2015 12:16 am

BTW I should think that the original error message you were getting (that it couldn't find the handler in the card script) was the engine complaining that there was no matching handler in the script because the card script hadn't compiled)

The error message could be more informative I agree - but no handlers/functions appearing in the left pane is a clear indication that something is wrong
"...this is not the code you are looking for..."

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: Handlers not found in card script

Post by dave.kilroy » Fri Feb 06, 2015 12:27 am

Hi Martin, just noticed your question:
xoolonite wrote:The handlers are not showing in the left hand list and I have tried to find out why! When adding to card script they are not saving??
Is there an edit mode that needs switching on?
The answer is no, nothing special to turn on - try creating a new card or open the script of any object and create a new hander (call it something like "mytesthandler" and once you hit compile the handler name should appear on the left
"...this is not the code you are looking for..."

dave.kilroy
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 858
Joined: Wed Jun 24, 2009 1:17 pm
Location: Plymouth, UK
Contact:

Re: Handlers not found in card script

Post by dave.kilroy » Fri Feb 06, 2015 12:31 am

Should have said - the fact you can't get handlers to appear on the left in your card script is a sign that something is wrong with that script - try commenting out everything in the script and see if you can create the 'mytesthandler' I mention before. If you script still won't co-operate then upload your stack to see if another person's eyes can see what is going on

Kind regards

Dave
"...this is not the code you are looking for..."

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”