Standalone app as Frankensteinian Monster

FlexibleLearning at aol.com FlexibleLearning at aol.com
Thu Oct 26 14:31:01 EDT 2006


Hi Mark
 
Well, it looks like you are doing a lot of unnecessary stuff. If you want  to 
'quit', all pendingMessages will terminate and all stacks will close  
automatically. If I read you right you need you only need...
 
on closeStackRequest -- confirm whether to close the window
answer question "Are you sure you want to quit the entire program?" with 
"Yes"  or "No"
if it is "No" then exit closeStackrequest
  if "ReloadingPrefs" is among the lines of the openStacks then
    save stack  "ExtraFiles/ReloadingPrefs.rev"
close stack  "ExtraFiles/ReloadingPrefs.rev"
  end if
  pass closeStackrequest
end closeStackrequest
 
Or am I missing something obvious here?
 
/H


The application quits normally albeit a touch slowly as it saves various  
stacks (only when in the development environment, stacks are not saved  
except for a preferences stack which is outside the standalone in a set  
of "extra files")

I have the following code in a closeStackRequest  handler in my topmost 
(main) application stack ( I have commented out  various activities to 
try and find the  stoppage):

-------------------------
on closeStackRequest -- confirm  whether to close the window
answer question "Are you sure you want to  quit the entire program?" 
with "Yes" or "No"
if it is  "Yes"
then
if the environment is  "development"
then
leavingDevelopment
pass  closeStackRequest
end if
if the  environment is "standalone application"
then
--quietDisconnectDB
--leavingApplication
--      quit
--close  stack "Navigator"
KillAllPendingMessages
--pass  closeStackRequest
quit
end if
end if
end closeStackRequest

on  KillAllPendingMessages --courtesy of the list archives
repeat  for each line i in the pendingMessages
cancel (item  1 of i)
end repeat
end KillAllPendingMessages

on  leavingApplication
if "Navigator" is among the lines of the  openStacks
then
close stack  "Navigator"
end if
if "Bullets" is among the lines of the  openStacks
then
close stack "Bullets"
end if
if "Attic" is among the lines of the openStacks
then
close stack "Attic"
end if
if  "AboutStack" is among the lines of the openStacks
then
close stack "AboutStack"
end if
if "Calendar" is among the lines of the openStacks
then
close stack "Calendar"
end if
if  "Primer" is among the lines of the openStacks
then
close stack "Primer"
end if
if  "Suppliers" is among the lines of the openStacks
then
close stack "Suppliers"
end if
if  "Brass" is among the lines of the openStacks
then
close stack "Brass"
end if
if  "Propellant" is among the lines of the openStacks
then
close stack "Propellant"
end if
--    if "Loads" is among the lines of the openStacks
--    then
--      close stack  "Loads"
--end if
if "Loads" is among the lines of the  openStacks
then
close stack "Loads"
end if
if "Help" is among the lines of the openStacks
then
close stack "Help"
end if
save  stack "ExtraFiles/ReloadingPrefs.rev"
if "ReloadingPrefs" is among the  lines of the openStacks
then
close stack  "ExtraFiles/ReloadingPrefs.rev"
end if
end  leavingApplication

Any help, insight, pointers to working similar  applications which do 
evince a Frankensteinian lineage greatfully  received.
-------------------------
 



More information about the use-livecode mailing list