At 21:08 -0800 01_03_23, Kerry Thompson wrote:
>>  > Would it also be unstable if you use  "tell the stage" in the window, to
>>>  call a handler in the stage's movie script, that closes that window?
>>
>>in my experience, it is still an unstable way to close a MIAW.
>
>Unless I'm reading Karina's question wrong, there's nothing wrong 
>with her approach.
>
>The central point is that the MIAW doesn't close itself, but that 
>the main window closes it.
>
>In Tab's example, the main window gets the information from a 
>global. Karina's method simply passes the information via "tell the 
>stage." Either way, it's the main window--the stage--closing the 
>MIAW.


Kerry, I know you ROCK so much, so I'm sorry, but I'll have to 
correct on this one!
The point is not from which "Scope" the miaw is closed. The point is 
from which scope the event closing the MIAW originates.
This is so for a number of complex object types in Director:
An event from originating from the complex object itself leading to 
it's own destruction, will lead to a crash, presumably because "the 
event can not terminate in the call stack" or some techno babble.

So it is central that the event closing the MIAW is an event 
originating from another object, in this case the stage. That is why 
people bother to store flags or references in globals.

Still though if you feel a little adventurous and like D8's 
timeOutObjects, I personally find my own solution below quite 
elegant:  ;-)
(And I've posted it here just recently, so what's the bleedin' 
problem with you folks?)


In the Miaw have these 2 scripts:
(requires D8)

--------<movie script>--------
on closeWindow
   script("miawCloserClass").new(the activeWindow)
end
--------</movie script>--------

--------<parent script "miawCloserClass">--------
--miawCloserClass

property pWindow

on new me, aWindow
   pWindow = aWindow
   tell the stage to timeOut(me.string).new(0, #dummy , me)
end

on exitFrame me, aTimer
   aTimer.forget()
   pWindow.forget()
end
--------</parent script "miawCloserClass">--------

That should rid you completely of the Miaw... unless you have stored 
references to the Miaw.

You can structure the above code differently; pass or not pass 
arguments, and even place the "miawCloserClass" script in the stage. 
All that matters is that the "miawCloserClass" object is placed in 
the timeOutList of the stage, and not of the window to be destroyed.

Jakob

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/LUJ/lingo-l.cgi  To post messages to the list,
email [EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED])
Lingo-L is for learning and helping with programming Lingo.  Thanks!]

Reply via email to