preOpenStack and preOpenCard

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Tom
Posts: 11
Joined: Wed Feb 13, 2008 10:25 pm

preOpenStack and preOpenCard

Post by Tom » Mon Mar 24, 2008 8:29 pm

I have a sub-stack with one card called "Summary". The 'home' stack has a button as follows:
on mouseUp
open stack "Summary"
end mouseUp


In the stack script of sub-stack, I have a preOpenStack handler as follows:
on preOpenCard
global currentYear
convert the date to dateItems
put item 1 of it into currentYear
end preOpenCard


This works, whether I do it with a preOpenCard or preOpenStack.

However, in the one card (of the stack "Summary") the following script
on openCard
global currentYear
set text of currentYearLabel to currentYear
set text of previousYearLabel to currentYear-1
set text of previousPreviousYearLabel to currentYear-2
end openCard

does NOT work and error that occurs is in the button script of the open stack command in the home stack. I want this script above (plus more) to be done before the card opens.

I've tried every combination of preOpenCard/preOpenStack, putting the code in the button, putting it in the "Summary" stack, putting it in the card and always the same error.

I've done a search on Dan Shafer's book for insight, plus the User Guide and read the 'dictionary' entries about 400 times and I'm just stumped after probably 4 hours of struggling on getting the card looking right BEFORE it displays. Help!

Tom
Posts: 11
Joined: Wed Feb 13, 2008 10:25 pm

Post by Tom » Tue Mar 25, 2008 12:33 am

Never mind... I found the errors...

Post Reply