what's "this" stack
Robert Brenstein
rjb at robelko.com
Wed Nov 17 07:06:05 EST 2010
On 15.11.2010 at 17:42 Uhr -0800 Mark Smith apparently wrote:
>Robert Brenstein wrote:
>>
>> change your code as follows to resolve this for yourself ;-)
>>
>> on savenotes
>> modeless stack "save"
>> answer "Saving" && (the short name of this stack) -- just to know
>>
>>
>
>Interesting, when I put the answer line in the notepad stack script I get
>"saving notepad". But when I put it into the "save" substack it says "saving
>save". I couldn't find a way for the "save" substack to say "saving notepad"
>and "saving save" looks dumb. So, yes, I know now which stack is being saved
>but how do I let the user know? One idea (not tested) is to put a blank
>label in the save stack and then try and put the Saving && stuff into the
>save stack label. I think i'll give that a try and let you know how it
>works.
So what you find confirms that 'this' refers to the active stack,
which should be what the defaultstack function returns.
The answer command was meant only to figure out what is the meaning
of 'this' at that point. You said that one stack is the substack on
the other, so it does not matter which "this" is being saved since
saving affects all stacks in a given stackfile.
I presumably misunderstood what you meant, but using answer to tell
something to end-user (in context of saving) is not a good idea since
answer interrupts the program.
If you want to enhance your program to tell user the name of its file
(if your program can open multiple user files, for example), you can
pass it as parameter, keep in a global/local (depending on your
structure) or reverse engineer from the mainstack's name/title.
Robert
More information about the use-livecode
mailing list