Pasing/Saving/Restoring a Card's Contents

David Burgun dburgun at dsl.pipex.com
Fri Apr 9 10:35:05 EDT 2004


Hi,

I am trying to work out the best way to handle saving a card' 
contents. If I have a stack that is run from another stack in order 
to obtain some values from the User, what is the best way to:

1.  Save the State of the Card (all it's controls).
2.  Obtain the Values of the Controls from the Calling Script.
3.  Restore the Old Contents if the user presses Cancel.

I would like to be able to return the Button that dismissed the Stack 
(usually OK or Cancel in this case).

In one Stack I have, I set the Script on the OK button to:

on mouseUp
save this stack
close this stack
end mouseUp

and on the Cancel Button:

on mouseUp
close this stack
end mouseUp

But this seems to Save the State of the Stack/Card anyway, regardless 
of whether a "save this stack" command is issued or not.

I had thougt of adding a Script on the preOpenCard handler that saves 
the current Card to a Temp Stack and restores that card if the Cancel 
Button is pressed.

Also I am not sure of the best way to access the values, in the case 
a text field called "PageSize" and if the OK button is pressed then I 
want to take some action, if cancel then I don't want to do anything.

I can't seem to find any Sample Stacks that do this. Any pointers 
would be a great help.

Thanks
Dave


More information about the use-livecode mailing list