Go to card and preOpenCard message
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Go to card and preOpenCard message
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
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
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
-
- VIP Livecode Opensource Backer
- Posts: 9660
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Go to card and preOpenCard message
Klaus.
Inhibit.
Craig
Inhibit.
Craig
Re: Go to card and preOpenCard message
Sorry, I meant inhibit...
(thanks Craig! We posted at the same time )
The script is in the preOpenStack of the main stack
Then in the card I have this script
(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
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
Hmmm, nothing unusual, should work!
Does it work if you use "opencard" instead of "preopencard"?
Does it work if you use "opencard" instead of "preopencard"?
Re: Go to card and preOpenCard message
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)Klaus wrote:Hmmm, nothing unusual, should work!
Does it work if you use "opencard" instead of "preopencard"?
There are alterntives to start the clock without using the openCard/preOpenCard (without user intervention)?
-
- VIP Livecode Opensource Backer
- Posts: 7235
- Joined: Sat Apr 08, 2006 8:31 pm
- Location: Minneapolis MN
- Contact:
Re: Go to card and preOpenCard message
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.
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.
Last edited by jacque on Thu Dec 01, 2016 6:22 pm, edited 1 time in total.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com
Re: Go to card and preOpenCard message
Thank you Jacqueline!
Re: Go to card and preOpenCard message
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.