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

Klaus Major klaus at major-k.de
Thu Apr 22 09:33:24 EDT 2004


Hi David,

> 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!

There have been several hints on this in the original thread...

OK, you don't see your stack as something that could be called 
"preferences" and thus
you did not like my first proposal... (To store any prefs-info in the 
"prefs"-folder of the user...)

Actually one could call that stack a "document" and the ideal would 
probably be, to ask the user
where he wants to save it, right?!

But to do this you suggested to clone that (main?) stack to be able to 
save it, since it is part
of your standalone, which can cause trouble, too...

Someone suggested to make that stack NOT part of the standalone, so you 
could save that stack...
But looks like you did not like this idea either...

Here is another suggestion that will work fine with the "prefs-folder" 
function, mentioned in one of my earlier posts...

The concept:

Put the stack that you want to save into a customproperty of your 
"splash-screen"-stack or whatever
stack you build your standalone from!
NO problems compared to "clone stack xyz" ;-)

Then on startup you can check if there is that special file in the 
prefs-folder...

If yes, open that stack :-)

If no, "put the myUserStack of this stack into url("binfile:" & 
prefsfolder()...") and THEN open that stack :-)

Works fine, noone will ever know, everyone is happy, bring your kids :-D
I never had problems with it!

It also eliminates the possible problem that you don't have 
write-permissions in the application folder
on some platforms, if not logged in as admin!

OK, and here is how to do it...

1. To import your stack into a customproperty called myUserStack:

set the myUserStack of stack xyz to 
url("binfile:Path/to/your/stack.rev")

Save stack xyz and that's it...

2. To check, if the file exists, and spit out the customproperty if not:

on xyz
    if there is NOT a file (prefs_folder() & "name_of_file_here") then
      put the myUserStack of stack xyz intoto url("binfile:" & 
prefsfolder() & "name_of_file_here")
   end if
   go stack (prefs_folder() & "name_of_file_here")
end xyz

Et voila, done :-)

Once the stack is open, you can refer to it by its real name and not 
the filename anymore...

And then when needed you can simply:

save stack "real name of the stack here"


Does that sound a bit more useful to you?

> 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.

Sometimes there are nothing but "choices", more or less satisfying... 
;-)
But no "ready to use" solutions...

> I've been led down so many blind all allies it's untrue!

Hey, the sun is shining (at least here in germany), so put a smile on 
your face :-)

When i dived into SuperCard/MetaCard/Revolution a couple of years ago, 
i did not have
internet access at all, so i couldn't participate in this extremely 
nice and helpful list!

So take it easy ;-)

> Thanks a lot
> Dave

Regards

Klaus Major
klaus at major-k.de
www.major-k.de



More information about the use-livecode mailing list