keyboard shortcut
BlitzMax Forums/BlitzMax Beginners Area/keyboard shortcut| 
 | ||
| Okay I am sure this is buried in the documentation somewhere and I just can't find it, but how do you do the keyboard shortcut to quit?  Y'know, Control+Q on Windows and Command+Q on Mac. | 
| 
 | ||
| Assuming you ask how to close an application created with BMax, I don't think it is possible to quit it like that (at least not when you're inside a loop). You could try something like "If KeyDown(KEY_LCONTROL) And KeyHit(KEY_Q) Then Exit" I'm not totally sure though. | 
| 
 | ||
| Yeah that's what I meant.  I see an event for hotkeys and MODIFIER_COMMAND, how do those work? | 
| 
 | ||
| http://blitzmax.com/Community/posts.php?topic=68044#760212 Someone posted a small example there that might help. | 
| 
 | ||
| Interesting.  I can use Control+Q to quit on a Mac, but Command+Q is ignored.  Presumably that's because the operating system is already "trapping" that event.  How can I make that quit?  People are going to be expecting that since that's standard for Mac applications. | 
| 
 | ||
| You might want to have a look at the AppTerminate() function that returns True if the user has requested the application to close. On a Mac, this is probably going to be set to True if you use the Command+Q shortcut option. | 
| 
 | ||
| ALT+F4 is the standard Win OS shortcut to quit, at least it's the one I use. | 
| 
 | ||
| Thanks for pointing out that command Seb, I didn't know about that.  Unfortunately, polled input commands don't work with GUI stuff, I need to know how to detect that with events.  Although you give me a big clue; perhaps there's an AppTerminate event? Also, I just noticed the GUI editor in your sig. I'll have to check that out, it would have saved me a lot of time setting up the buttons on the editor I'm working on! | 
| 
 | ||
| You might be able to use enablepolledinput(). Don't think it's in the documentation but do a search as there has been some discussion about it. | 
| 
 | ||
| Righto, Seb's suggestion pointed me toward the answer I needed.  I didn't notice it before when looking at the events list, but there is an EVENT_APPTERMINATE that triggers when you use the default Quit shortcut for the OS.  Thanks Seb! |