More-Save Stack Woes - Could someone PLEASE explain this...

Robert Brenstein rjb at rz.uni-potsdam.de
Thu Apr 22 08:22:28 EDT 2004


>Hi,
>
>I know I could save the setting somewhere and restore them when 
>Cancel is pressed, but isn't there another way?
>
>I have many hundreds of controls in a large number of dialog boxes 
>and to save them all manually will be a lot of work.
>
>Could I save the whole (sub-)stacks/cards at a time and restore them 
>when Cancel is pressed?
>
>Any tips on doing this would be greatly appreciated!
>
>It's not so much the leanring curve that's getting me down! It's the 
>lack of any concrete answers to things that I know are possible. 
>I've been led down so many blind all allies it's untrue!
>
>Thanks a lot
>Dave

Your logic fails on the following: saving a stack, saves its state to 
disk, so when you open it in another session, the 'new' version is 
used. However, within a current run, whether you save it or not, the 
current status is in memory. Closing the stack does not change 
anything. Its last state remains in memory ready for subsequent use.

It follows that 'cancel' does not magically revert to the state 
before user toggled some checkboxes (as it is in a case of C program 
that call a dialog from DLOG resource). You either need to reset 
things on 'cancel' or preserve new settings on 'save'. I see no way 
around it. Take your peek which is better.

Now, you do not to save them ALL manually. This is what scripting is 
for. You simply loop through your controls and save their state 
programmatically.

Robert Brenstein


More information about the use-livecode mailing list