Page 1 of 1
Go to card and preOpenCard message
Posted: Wed Aug 13, 2014 1:15 pm
by Mag
In a standalone I'm using the "Go to card" command to go to the card user leaved when closing the app. In that card I have a preOpenCard handler. All works fine if the user navigate thru the cards but if I use the go to command to go to that card it seems to me that the preOpenCard message is not trigged. Is that command inibite from the go to command o maybe I'm doing something wrong?
Re: Go to card and preOpenCard message
Posted: Wed Aug 13, 2014 2:22 pm
by Klaus
Hi Mag,
no idea what "inibite" means, but it should work!
What is in your "pre-/openstack" and "pre-/opencard" handlers?
And WHEN do you fire this "go to cd..."?
Best
Klaus
Re: Go to card and preOpenCard message
Posted: Wed Aug 13, 2014 3:00 pm
by dunbarx
Klaus.
Inhibit.
Craig
Re: Go to card and preOpenCard message
Posted: Wed Aug 13, 2014 3:12 pm
by Mag
Sorry, I meant inhibit...
(thanks Craig! We posted at the same time
)
The script is in the preOpenStack of the main stack
Code: Select all
on preOpenStack
put the currentCardWhenClosed of this stack into theCard
if theCard is not "" then
go to card theCard
end if
end preOpenStack
Then in the card I have this script
Code: Select all
on preOpenCard
updateClock
end preOpenCard
on updateClock
put the long system time into field "ClockField" of card "Clock"
put the long system date into field "DateField" of card "Clock"
send "updateClock" to me in (1 - (the long seconds mod 1)) seconds
end updateClock
Re: Go to card and preOpenCard message
Posted: Wed Aug 13, 2014 3:30 pm
by Klaus
Hmmm, nothing unusual, should work!
Does it work if you use "opencard" instead of "preopencard"?
Re: Go to card and preOpenCard message
Posted: Wed Aug 13, 2014 3:35 pm
by Mag
Klaus wrote:Hmmm, nothing unusual, should work!
Does it work if you use "opencard" instead of "preopencard"?
Tested also in openCard, it doesn't work (BTW here are lot of other code in preOpenStack and the stack is a clone of the main stack I use as template saved on disk as stack document)
There are alterntives to start the clock without using the openCard/preOpenCard (without user intervention)?
Re: Go to card and preOpenCard message
Posted: Wed Aug 13, 2014 6:54 pm
by jacque
Is the clock on a card in the main app or is the app loading a separate stack that contains the clock? If you are opening a separate stack for the second time in the same session, no "open" messages are sent if the stack's destroystack is false. Instead you will get a resumestack message. The "open" messages are only sent the first time the stack loads.
You can either use the resumestack message, or just set destroystack to true on the stack.
If the clock card is in the app itself then your original code should work.
Edit : the open messages are sent normally if you go to another card, they are only omitted from the current card when the stack is resumed. That's because the card is technically already open in memory.
Re: Go to card and preOpenCard message
Posted: Thu Dec 01, 2016 3:02 pm
by Mag
Thank you Jacqueline!
Re: Go to card and preOpenCard message
Posted: Sun Jan 15, 2017 2:53 am
by Mag
Recently I had a similar problem and found that I was handling the preOpenCard in the Stack script, but there was a preOpenCard also in the Card, so the one of the card prevented the one of the stack to trigger. I solved with a "pass preOpenCard" in the card script.