get menu quit in standalone

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

get menu quit in standalone

Post by jmburnod » Tue Aug 18, 2009 3:41 pm

Hi All,

What is the way to get the result of the quitmenu for a standalone on window and Linux

I have this for Mac

Code: Select all

on appleEvent theClass,theID,theSender
   put theclass & theID into bufAE
   if bufAE is "aevtquit" then
      QuitMoi
   end if
end appleEvent
Thank for help

Jean-Marc

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Tue Aug 18, 2009 5:14 pm

Hi Jean-Marc,

What is a quit menu? Do you mean the Quit menu item in the File menu under Windows and in the application menu under Mac OS X? Or do you mean the menu in the top-left corner of Windows menus?

If you mean the Quit menu item in the File menu, you can simply handle the menuPick message in the File menu button. Just make this button quit your application.

If you mean the menu in the top-left of the window, you might try catching the shutdownRequest message. This should actually also work on Mac OS X instead of the appleEvent message.

Here's a good example of how to quit your standalone properly. You may need to make slight adjustments to the handler, because it assume you're using MySQL for instance. Just comment out what you don't need.

Best,

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

jmburnod
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2729
Joined: Sat Dec 22, 2007 5:35 pm
Contact:

get menu quit in standalone

Post by jmburnod » Tue Aug 18, 2009 7:03 pm

Thank Mark,

On OSX i have a 2 menu by default when i build the standalone
The first item is "about..." and the last quit (the name of the app)
The problem is solved with the script of my first post

But, i dont know if it is the same on window and what is the way to get it

Idem for menuitem "About..."

I readed your script quitmyproject
How you call it if the user type Command-Q ?

best

Jean-Marc

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Post by Mark » Tue Aug 18, 2009 7:44 pm

Hi Jean-Marc,

I tried to explain that the approach to deal with the Quit menu item is completely different on Mac OS X and Windows.

On Mac OS X, you can indeed use the script you posted, but there is a shutdownRequest message that does the same.

On Windows, you have to handle the menupick message, as I said in my previous e-mail. The menupick message is sent to the menu button after e menu item has been selected from it. Read the docs about the menupick message!

Best,

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

Post Reply