closeStackRequest and closeStack problems

David Burgun dburgun at dsl.pipex.com
Thu Apr 21 15:29:23 EDT 2005


Hi,

I have the following scripts in CARD script of Card 1 - this is to 
avoid problems when doing saves etc. in the IDE.


If I run the Stack, click the dirty button and then click the window 
close box, I get the following events:

closeStackRequest
closeStack

And it saves as Planned - ALWAYS!!!!

If I run the Stack, click the dirty button and then click the OK 
button, I ge the following events:

closeStack the FIRST time I run it from an IDE reload.

If I re-open the Stack, click the Dirty button and then the OK button 
I do NOT get the closeStack message! But the Stack closes.

Is this something to do with having the Handlers in the Card Script 
rather than the Stack Script?

Does anyone know how to get around this problem or what I am doing wrong?

Thanks a lot
Dave

open openStack
set the destroyStack of this stack to true
set cpStackSaved of this stack = false
set cpStackDirty of this stack = false
set cpStackSaveStack of this stack = true
end openStack



on closeStack
if cpStackSaved of this stack = false then
    if cpStackDirty of this stack = true then
        save this stack
       set the cpStackSaved of this stack to true
       set the cpStackDirty of this stack to false
     end if
end if
end closeStack


on closeStackRequest
if cpStackSaveStack of this stack = false then
   if cpStackDirty of this stack = true then
     answer "Save this Stack?" with "No" or "Yes"
     if it is "Yes" then
       set the cpStackSaved of this stack to true
       set the cpStackDirty of this stack to false
     end if
   end if
end if

pass closeStackRequest
end closeStackRequest

and this script on an OK button

on mouseUp
   close this stack
end mouseUp

and on a "Dirty" Button
   set cpStackDirty of this stack it true
on mouseUp
set the






More information about the use-livecode mailing list