Page 1 of 1

"on opencard" handler

Posted: Tue Oct 11, 2011 9:03 pm
by churchken
Hi,

This one has me stumped.

A stack's "on opencard" handler works fine in dev environment, but fails to execute in stand alone version.

I've deleted the handler, rebuilt it, tried totally different code in a handler by that name -- all work fine while in livecode, but fail after stand alone is built. This is specific to this stack, as "on opencard" still works in stand alone versions of other stacks created after this problem started.

Anyone seen this type of behavior before?

Thanks.

Re: "on opencard" handler

Posted: Wed Oct 12, 2011 7:51 am
by SparkOut
Hi Ken
My first thought is to check the handler for oddness in the script, it definitely seems to be only affecting this one handler, so that is the place to begin your investigation. Therefore some lines of script code would be helpful.
My first guess is maybe you have a handler looking up folder paths?? In the IDE the relative path is from the location of the engine, while in a standalone it is from the location of the standalone executable. If so, you may need to adjust the location where the handler is looking by getting a relative folder path by parsing "the effective filename of this stack".
Otherwise... I guess seeing some script is the only idea I have at the moment.

Re: "on opencard" handler

Posted: Wed Oct 12, 2011 1:37 pm
by churchken
Hi, Sparkout,

Thanks for your reply. The script code "inside" the "on opencard" handler does not change the situation. Deleting the entire code, then using:

on opencard
put "This time it worked" & CR into fld"testlog"
end opencard

also fails to place the text in that field. It's like there is something corrupted in the livecode that causes any "opencard" handler to fail.

As a last resort, I will rebuild the stack code from scratch, but that is not a pleasant alternative.

Thanks.

Re: "on opencard" handler

Posted: Wed Oct 12, 2011 2:59 pm
by Klaus
Hi Ken,

it is also worth a try to only re-build that card!
Delete it and create a new one, should work 8)


Best

Klaus

Re: "on opencard" handler

Posted: Wed Oct 12, 2011 4:45 pm
by AndyP
What happens if you use

preOpenCard

instead of

openCard ?

Also you say at the begining of your post 'A stack's "on opencard"..' Just to check you're putting the openCard in the cards script and not the stacks?

Re: "on opencard" handler

Posted: Wed Oct 12, 2011 5:38 pm
by jacque
The most likely reason is that you have an opencard handler in the card that is blocking execution of the opencard handler in the stack. Also check group and background scripts, because those can block too.

Re: "on opencard" handler

Posted: Wed Oct 12, 2011 5:47 pm
by mwieder
Yes, but that doesn't necessarily explain why it works in the IDE and not in a standalone. That part's puzzling.

Re: "on opencard" handler

Posted: Wed Oct 12, 2011 6:26 pm
by jacque
Oh right, forgot about that part. I guess we'd need to see an example stack.

Re: "on opencard" handler

Posted: Wed Oct 12, 2011 6:49 pm
by mwieder
That would be useful. Ken?

I do notice that there's no space between fld and "testlog" in your typed example. I assume it's right in the actual stack. And that there's a "testlog" field available for the text.

Re: "on opencard" handler

Posted: Thu Oct 13, 2011 1:03 pm
by churchken
Thanks to everyone for the helpful ideas.

In the end, I did "rebuild" the card from the most recent backup copy of the livecode which still worked correctly. Not too much downtime connected with it.


MWieder -- gosh, I've never used a space after the FLD and it's always worked OK for the field update.

Again, thanks to all the generous folks here. The "Revolution" community is first rate!

Regards,

Re: "on opencard" handler

Posted: Thu Oct 13, 2011 6:19 pm
by mwieder
MWieder -- gosh, I've never used a space after the FLD and it's always worked OK for the field update.
<g> I've never *not* used a space... I guess it's good to know it works both ways.

Glad you got it working.