Open Stack script
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 137
- Joined: Thu Jul 24, 2008 11:22 pm
Open Stack script
I have an openStack script that runs when I open a substack. I only want it to work when the main stack opens. How do I limit it to working just with the main stack?
cheers
Glenn
cheers
Glenn
Re: Open Stack script
The following should work in your mainstack script:
... “MainStackName” of course being the name you gave your main stack. The “pass openStack” is perhaps worth including if later you want to add instructions which only execute when opening substacks, e.g.:
Regards,
Michael
Code: Select all
on openStack
if the short name of this stack = "MainStackName" then
-- the specific instructions you want
pass openStack
end if
end openStack
Code: Select all
on openStack
if the short name of this stack = "MainStackName" then
-- the specific instructions you want
pass openStack
end if
-- instruction when opening substack
-- instruction when opening substack
end openStack
Michael
Re: Open Stack script
Hi Glenn,,
you can also put the "openstack" and "preopenstack" handlers into the script of the first card of that (main-) stack!
This way only the mainstack will get these messages (which do also get sent to the first card of the stack!).
Best
Klaus
you can also put the "openstack" and "preopenstack" handlers into the script of the first card of that (main-) stack!
This way only the mainstack will get these messages (which do also get sent to the first card of the stack!).
Best
Klaus
-
- VIP Livecode Opensource Backer
- Posts: 10052
- Joined: Sat Apr 08, 2006 7:05 am
- Contact:
Re: Open Stack script
That's what I do. It's simpler than adding an IF condition, and keeps initialization handlers limited to a single script that can't interfere with anything else.Klaus wrote:you can also put the "openstack" and "preopenstack" handlers into the script of the first card of that (main-) stack!
This way only the mainstack will get these messages (which do also get sent to the first card of the stack!).
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Open Stack script
Once again I learn something new. The Rev forum is both an education and an inspiration.
Cheers,
Michael
Cheers,
Michael