I can't seem to figure out what I am missing. I have a main stack with several substacks. All of then use the same menu bar. When I build a stand alone, the Quit menu item is called if I have not opened one of the substacks. Opening and closing a substack seems to keep the menu handler script from firing for Quit only ( this is under OSX so the Quit menu item appears in the app under the applications menu rather than FIle). All of the other menus keep working however (even those under the File menu in menu builder). Why is the Quit menu item treated differently and what do I do so that it can be called? Closing the windows does quit the app which is also undesirable but livable.
Thanks,
John
Quit sometimes works
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
Re: Quit sometimes works
Hi John,
The Quit menu item works independently of scripts, but before your LiveCode standalone quits, the shutDownRequest handler will be executed. Example:
Kind regards,
Mark
The Quit menu item works independently of scripts, but before your LiveCode standalone quits, the shutDownRequest handler will be executed. Example:
Code: Select all
on shutdownRequest
close stack "substack 1"
put empty into field 'Some Field" of stack "Mainstack"
pass shutdownRequest
end shutdownRequest
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Re: Quit sometimes works
Mark,
Thanks for the reply. I did place a shutdownRequest handler in backscript to handle other things but did not close the substacks in it. I just added the "close stack" bits to close the substacks and my backscript now looks like:
on shutDownRequest
local theFile
put makePreferencesFile() into theFile
writePreferences theFile
close stack "substack 1"
close stack "substack 2"
close stack "substack 3"
close stack "substack 4"
close stack "substack 5"
pass shutDownRequest
end shutDownRequest
This did not work. Placing this in the main stack script also did not work. I added a close stack for the main stack as well to no avail. Any other suggestions? The preferences file is created only if another substack had not been opened previously indicating that a shutdown request is never generated. The application still does not quit until I close the main stacks window with the red jewel.
Thanks,
John
Thanks for the reply. I did place a shutdownRequest handler in backscript to handle other things but did not close the substacks in it. I just added the "close stack" bits to close the substacks and my backscript now looks like:
on shutDownRequest
local theFile
put makePreferencesFile() into theFile
writePreferences theFile
close stack "substack 1"
close stack "substack 2"
close stack "substack 3"
close stack "substack 4"
close stack "substack 5"
pass shutDownRequest
end shutDownRequest
This did not work. Placing this in the main stack script also did not work. I added a close stack for the main stack as well to no avail. Any other suggestions? The preferences file is created only if another substack had not been opened previously indicating that a shutdown request is never generated. The application still does not quit until I close the main stacks window with the red jewel.
Thanks,
John
Re: Quit sometimes works
Mark,
I should have read what you were saying a bit more carefully. In the scripts where I was writing the current state of the application (my script makePreferencesFile) I was referring to some fields and buttons on the main stack. Apparently the main stack is 'gone' for lack of a better term even though the script is executing from its (the main stacks) stack script. I removed the back script to verify this. So, if I use the long form and append a ' of stack "main stack" ' to all field and button references it works. Apparently a script error cancels the quit process. In any case it is solved.
Thanks,
John
I should have read what you were saying a bit more carefully. In the scripts where I was writing the current state of the application (my script makePreferencesFile) I was referring to some fields and buttons on the main stack. Apparently the main stack is 'gone' for lack of a better term even though the script is executing from its (the main stacks) stack script. I removed the back script to verify this. So, if I use the long form and append a ' of stack "main stack" ' to all field and button references it works. Apparently a script error cancels the quit process. In any case it is solved.
Thanks,
John
Re: Quit sometimes works
Cool. I'm glad it works now.
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode