Error Message

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
laurpapo
Posts: 38
Joined: Thu Jun 21, 2012 4:25 pm

Error Message

Post by laurpapo » Tue Jul 03, 2012 4:04 pm

Hi,

Can you tell me what this error message means? Or how I would go about fixing it? The object in question is a field I'm trying to delete. For some reason it won't let me...

stack "C&LMapper": execution error at line n/a (Object: stack locked, or object's script is executing)

Thanks!

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

Re: Error Message

Post by Klaus » Tue Jul 03, 2012 4:17 pm

Hi Laurel,

what did you script and what object is (trying to) executing the script?


Best

Klaus

laurpapo
Posts: 38
Joined: Thu Jun 21, 2012 4:25 pm

Re: Error Message

Post by laurpapo » Tue Jul 03, 2012 4:33 pm

This is the script:

on undogroup
local tLinktoDelete
set the itemdelimiter to tab
put item 3 of line 2 of gLastAction into tLinktoDelete
repeat until lineoffset(tLinktoDelete, gCurrentlinks) =0--repeats until all of the graphic lines are gone
delete graphic line lineoffset(tLinktoDelete, gCurrentlinks) of gCurrentLinks--deletes lines connected to deletednodes
delete line lineoffset(tLinktoDelete, gCurrentlinks) of gCurrentLinks
end repeat
delete field item 3 of line 1 of gLastAction
delete field item 3 of line 2 of gLastAction
end undogroup

It's in the stack script, called by a button. Everything works fine until the last line. That field isn't getting deleted.

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

Re: Error Message

Post by Klaus » Tue Jul 03, 2012 5:34 pm

Hmm, no quick idea...

Does adding parens help?

Code: Select all

...
  delete field (item 3 of line 1 of gLastAction)
  delete field (item 3 of line 2 of gLastAction)
end undogroup
Best

Klaus

laurpapo
Posts: 38
Joined: Thu Jun 21, 2012 4:25 pm

Re: Error Message

Post by laurpapo » Tue Jul 03, 2012 5:41 pm

Nope :(

However, after some sleuthing I think I know what the problem is. At a different place in the stack script, a "mousedown" is sent to the field I want to delete. If I delete that command, I no longer have the problem. The "mousedown" is crucial at an earlier point, though, so I have to keep that in. Is there anyway to tell an object's script to stop executing? I kind of hoped "mouseup" would undo it but no such luck...

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

Re: Error Message

Post by Klaus » Tue Jul 03, 2012 6:08 pm

Hi Laurel,
laurpapo wrote:However, after some sleuthing I think I know what the problem is. At a different place in the stack script, a "mousedown" is sent to the field I want to delete. If I delete that command, I no longer have the problem.
AHA! Well in that case the error is definitively correct :-)
laurpapo wrote:The "mousedown" is crucial at an earlier point, though, so I have to keep that in. Is there anyway to tell an object's script to stop executing?
Depends on how you created your stack, app and message architecture!
Can't you handle it another way? Maybe wait until the "mousdown" has been executed?

Sorry, need more info...
laurpapo wrote:I kind of hoped "mouseup" would undo it but no such luck...
Well... 8)

Best

Klaus

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: Error Message

Post by mwieder » Tue Jul 03, 2012 6:38 pm

Code: Select all

-- only do this if the field has not been deleted
if there is a field "xyzzy" then
  send "mouseDown" to field "xyzzy"
end if

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Error Message

Post by Mark » Wed Jul 04, 2012 2:36 am

Hi,

Instead of telling the script to stop running, you can delete the fields after all other handlers have stopped running:

Code: Select all

send "delete field (item 3 of line 1 of gLastAction)" to me in 0 millisecs
send "delete field (item 3 of line 2 of gLastAction)" to me in 0 millisecs
or if that doesn't work

Code: Select all

send "delete field" && quote & item 3 of line 1 of gLastAction & quote to me in 0 millisecs
send "delete field" && quote & item 3 of line 2 of gLastAction & quote to me in 0 millisecs
Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

laurpapo
Posts: 38
Joined: Thu Jun 21, 2012 4:25 pm

Re: Error Message

Post by laurpapo » Thu Jul 05, 2012 6:41 pm

Thank you all for your help! I ended up finding a way around "mouseup" earlier in the script.

Thanks!

Post Reply