Page 1 of 1

preOpenStack and preOpenCard

Posted: Mon Mar 24, 2008 8:29 pm
by Tom
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!

Posted: Tue Mar 25, 2008 12:33 am
by Tom
Never mind... I found the errors...