Quitting standalone, is this a bug?

J. Landman Gay jacque at hyperactivesw.com
Thu May 17 17:02:40 EDT 2007


Michael Binder wrote:
> Devon Asay wrote:
> 
>> You might try this and see what happens:
>>
>>  if the style of this stack is topLevel then -- would only execute
>> if the stack receiving the shutdownrequest was non-modal.
>>
>>    if the visible of this stack then -- would ensure shutdownrequest
>> would only be handled in a visible stack
> 
> Hi Devon,
> I don't think that is a solution.  The problem with your suggestion
> is that "this stack" does not evaluate to "myApp".
> 
> Likewise, when I write:  "the short name of this cd", it never
> evaluates to the name of the card that the user is quitting from.

Right, that's what Devin's suggestion evaluates -- whether the card or 
stack that gets the shutdownrequest message is yours or not. If the 
stack is not a toplevel stack or the stack isn't visible (assuming your 
standalone mainstack is always visible) then the stack that received the 
message isn't one you want to handle. You could also check this way:

   if the short name of this stack is the mainstack of this stack then...

which would be true if it's your stack and false if it's not. There are 
other tests you could devise if you have several stacks you want to 
respond to.

In any case, you'd only evaluate the data if the stack that is being 
closed is yours, and you'd just pass the closestackrequest message if it 
wasn't. For example:

on closeStackRequest
  if the short name of this stack is the mainstack of this stack then
    -- do your data evaluation, it's your stack
  end if
  pass closeStackRequest -- pass it in all cases
end closeStackRequest

I agree that you are probably seeing the effects of a multi-window 
environment (something HyperCard didn't have.) The stack you are looking 
at isn't necessarily the first recipient of a system message. (See 
"defaultstack" in the dictionary; it's a new concept for 
ex-HyperCarders.) Stacks can be at the front of the message hierarchy 
even while not being visible, or not being "physically" in front. Using 
the above technique, you bypass the problem by only responding to the 
message if the stack that receives it is yours.

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list