Hi,
I have a fairly complex animation that changes the location of some img's, disables some buttons, etc. If the user leaves the card early in the middle of the animation I would like the card to be restored to its opening state on open card or before it closes the card. Just as if the stack was relaunched from its icon. I started trying to reset the state of all the objects but it began to get complicated. Is there an easy way to restore the card to its standalone saved state so that when I return to the card the animation can start again fresh? Thought about having a duplicate card in the stack and overwriting the card each time? Or I guess I could just not let the user leave until the anim is done and resets itself but that seems restrictive. Any better ideas?
Resetting a card to saved on close card.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Resetting a card to saved on close card.
One way is the "revert" command but that will reset the whole stack (not globals tho, if you need state information), however, that can produce a slight flash, so maybe not the best approach.
Another Idea would be to duplicate the stack or the card, and then delete the modified version when the user is done.
Another Idea would be to duplicate the stack or the card, and then delete the modified version when the user is done.
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
Re: Resetting a card to saved on close card.
Another way is to store the info about each control in custom properties and then restore them when you need to. During devlopment, run a handler like this:
Place everything where you want it, and then run that from the message box. If you ever want to change the positions of objects, you'll need to run it again. This is used for development only.
In your active working code you do this:
You can add other properties if you need them. You could also make these into a single custom property array instead of a bunch of individual properties if you want.
Code: Select all
on setupControls
repeat with x = 1 to the number of controls
set the cLoc of control x to the loc of control x
set the cEnabled of control x to the enabled of control x
end repeat
end setupControls
In your active working code you do this:
Code: Select all
on resetControls
lock screen
repeat with x = 1 to the number of controls
set the loc of control x to the cLoc of control x
set the enabled of control x to the cEnabled of control x
end repeat
unlock screen
end resetControls
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
HyperActive Software | http://www.hyperactivesw.com