REALLY close stack
Dave Cragg
dcragg at lacscentre.co.uk
Wed Jun 16 05:04:33 EDT 2004
At 5:55 pm -0400 15/6/04, Troy Rollins wrote:
>Sorry, the code example looks more like this...
>
>_________________________________________________________
> repeat for each line tFile in tFileList
> if there is a stack "Current Resource" then
> set the destroyStack of stack "Current Resource" to TRUE
> close stack "Current Resource"
> end if
>
> go invisible stack URL (the defaultFolder & "/" & tFile)
> if there is a field "NameField" of stack "Current Resource" then
>
> Put tFile & TAB & field "NameField" of stack "Current
>Resource" after field "Resource Select List" of card "Main
>Interface" of stack "The Program"
> end if
>
> set the destroyStack of stack "Current Resource" to TRUE
> close stack "Current Resource"
>
> end repeat
>________________________________________________________
I remember a problem somewhat similar from way back (in a previous
engine). I concluded (but can't confirm) that the problem occurred
because the removal of the stack from memory took place after the
handler finished running. So deleting stacks in a repeat loop may not
produce the desired effect. The solution was to use "send ... in
<time>" . Perhaps something like this (untested):
local lvFileList
on myHandler pFileList
put pFileList into lvFileList
destroyHandler
end myHandler
on destroyHandler
if there is a stack "Current Resource" then
delete stack "Current Resource"
end if
send "nextOpenHandler" to me in 50 milliseconds
end destroyHandler
on nextOpenHandler
if lvFileList is not empty then
put line 1 of lvFileList into tFile
delete line 1 of lvFileList
go invisible stack URL (the defaultFolder & "/" & tFile)
if there is a field "NameField" of stack "Current Resource" then
put tFile & TAB & field "NameField" of stack "Current Resource"
after field "Resource Select List" of card "Main Interface" of stack
"The Program"
end if
send "destroyHandler" to me in 10 milliseconds
end if
end nextOpenHandler
Cheers
Dave
More information about the use-livecode
mailing list