Page 1 of 2

Opening a version 8 stack in LiveCode 9

Posted: Fri Aug 28, 2020 9:08 pm
by minboden
Hello,

I have a stack that was created in Livecode 8 and I would like to upgrade to LiveCode 9. However when I open the stack in lc 9, the preOpenStack and openStack handlers do not fire (not even if I put a test button on the screen and tell it to run either of these handlers). I created a test stack in lc 9 with these handlers and it worked there. Has any one else had this problem? Any help would be appreciated!

Thank you

Re: Opening a version 8 stack in LiveCode 9

Posted: Sat Aug 29, 2020 12:14 am
by bangkok
Very strange. And never experienced that !

You need to follow a process :
-give us details about your OS, which LC version do you use (9) and the same for your "old" LC (8)

-try to reproduce the problem with a sample stack that you can send us after so people can have a look

-and/or fill in directly a bug report on https://quality.livecode.com

Re: Opening a version 8 stack in LiveCode 9

Posted: Sat Aug 29, 2020 1:20 am
by minboden
I am using Windows 10 64bit running LiveCode (9_6_1) Indy. The stack was created in LiveCode 8_1_10

I have made a copy of my stack and stripped it of everything but a button and two fields.
The stack script reads:

Code: Select all

on preopenstack
put "preopenstack worked" into fld 1
end preopenstack


on openstack
put "openstack worked" into fld 2
end openstack
The button script reads:

Code: Select all

on mouseup
preopenstack
end mouseup
When opening the stack neither preopenstack or openstack fire.

When I compile the stack into a standalone it works! How do I send you my stack? -- Sorry, I am very new to this forum:)

Re: Opening a version 8 stack in LiveCode 9

Posted: Sat Aug 29, 2020 8:47 am
by richmond62
Well, if you are new to this forum there is some sort of waiting period until you can post attachments,
so the best thing is, probably, to ZIP your stack and put it on a Dropbox account, a Google-Drive or
somewhere else like that and then post a download link here.

Re: Opening a version 8 stack in LiveCode 9

Posted: Sat Aug 29, 2020 10:04 am
by Klaus
Hi minboden,

welcome to the forum!
Due to high spamming you need to have at least seven posting before you can post attachments, links etc.
richmond62 wrote:
Sat Aug 29, 2020 8:47 am
WEll, if you are new to this forum there is some sort of waiting period until you can post attachments,
so the best thing is, probably, to ZIP your stack and put it on a Dropbox account, a Google-Drive or
somewhere else like that and then post a download link here.
Richmond, I think that's called "Catch 22"! See above. :-D


Best

Klaus

Re: Opening a version 8 stack in LiveCode 9

Posted: Sat Aug 29, 2020 7:06 pm
by jacque
The link could be altered to comply. We've seen enough of that to understand:
www (dot) domain (dot) com/ page (dot) html

Re: Opening a version 8 stack in LiveCode 9

Posted: Sun Aug 30, 2020 4:50 am
by mwieder
Technically the openstack and preopenstack handlers should be in the script of the first card in the stack, but I can't see that making a difference here.
You've got a very strange problem. Looking forward to your being able to post the stack here for forensics.

Re: Opening a version 8 stack in LiveCode 9

Posted: Sun Aug 30, 2020 9:00 am
by richmond62
Technically the openstack and preopenstack handlers should be in the script of the first card in the stack
That might just explain why, for years, I've had problems when I've put these in the stackScript.

The inevitable dirty question pops up, unbidden:

What is the stackScript for?

Re: Opening a version 8 stack in LiveCode 9

Posted: Sun Aug 30, 2020 10:12 am
by bangkok
richmond62 wrote:
Sun Aug 30, 2020 9:00 am
Technically the openstack and preopenstack handlers should be in the script of the first card in the stack
That might just explain why, for years, I've had problems when I've put these in the stackScript.
That's what i love with such a forum ! Even as an"old timer" it's possible to learn something.... striking ! :D

Why openstack and preopenstack should be on the first card script ?

Like you, I always put this kind of stuff within the stack script.

Re: Opening a version 8 stack in LiveCode 9

Posted: Sun Aug 30, 2020 12:28 pm
by SparkOut
It's the way the message path works. Such messages will go to the first card, and it doesn't matter whether it's a stack message, if it has a handler in the card script, it will be trapped there (unless passed). If no handler is in the card script, or passed, it will continue up to the stack.

The single biggest reason for putting a preOpenstack or openStack message in the card script is that in that case it will only be relevant to the stack in question. If you have a substack without a preOpenstack or openStack handler of its own, then when it opens it will fail to handle the message and then pass it to the mainstack script, and will trigger the mainstack handler, which is likely not appropriate.
Obviously closeStack and other stack messages apply - so even more relevant for a substack not to trigger a cleanup handler that closes and quits the mainstack, say.

I'm sure jacque or Richard would be able to explain much more succinctly,.

Re: Opening a version 8 stack in LiveCode 9

Posted: Sun Aug 30, 2020 5:31 pm
by jacque
You explained it perfectly, SparkOut.

I put handlers in the stack script that need to be accessed from anywhere in the stack. Generally these are custom handlers but not always. They include things like utility handlers, navigation handlers, server communication, and other generic handlers that can act on any card. A non-custom handler like scrollerDidScroll is in the stack script of my current project so it can respond to any mobile scroller anywhere. If I need a standard action for all cards it goes in the stack script; for example, closecard to delete all mobile controls before changing cards.

Re: Opening a version 8 stack in LiveCode 9

Posted: Sun Aug 30, 2020 6:37 pm
by mwieder
The preOpenStack and openStack messages first go to the card, and then if there's no handler there to catch them, pass on to the stack.
So in many cases it won't matter whether you put the handlers in the card script or the stack script.

But if you have substacks then each substack will also invoke the preOpenStack/openStack handlers if you have them in the script of the mainstack.
For that reason I isolate the handlers into the card scripts to keep things clean.
The alternative is to put dummy handlers into the substack scripts to prevent triggering the mainstack handlers again.

Re: Opening a version 8 stack in LiveCode 9

Posted: Mon Aug 31, 2020 6:47 pm
by minboden
Thank you for a the input every one has given. I put my stack up on onedrive. Here is the share link for it.

https://1drv(dot)ms/u/s!AhxknZXHwUWjpWRiQTnE8TB3KCkd?e=kAG9eL

Re: Opening a version 8 stack in LiveCode 9

Posted: Mon Aug 31, 2020 8:52 pm
by mwieder
Wow! That's one seriously messed-up stack.
You have a watched variable set on the stack itself

Code: Select all

Watches
   228660,mouseUp,tstacks
Watchstates
  Active
That causes an "object not found" error in the preOpenStack handler.
If you remove the watched variable information from the stack the handlers fire normally.
(using the Inspector, look at the cREVGeneral custom property set)

Re: Opening a version 8 stack in LiveCode 9

Posted: Mon Aug 31, 2020 11:52 pm
by FourthWorld
Well done, Mark. That stack mystified me. I would never have thought of LC's message watcher stuff as a potential issue. The more ya' know...