Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview

Buy Now

Issue 14.5 ('Keyboard Shortcuts')
Instant purchase and download via GumRoad!


No Shortcuts for Shortcuts

Supporting user-defined keyboard shortcuts is tougher than you'd think

Issue: 14.5 (September/October 2016)
Author: Marc Zeedar
Author Bio: Marc taught himself programming in high school when he bought his first computer but had no money for software. He's had fun learning ever since.
Article Description: No description available.
Article Length (in bytes): 45,700
Starting Page Number: 18
Article Number: 14504
Resource File(s):

Download Icon project14504.zip Updated: 2016-09-01 11:29:37

Related Link(s): None

Excerpt of article text...

Recently an xDev reader suggested I write an article about how to add the ability to customize keyboard shortcuts in a Xojo application. My first thought was that this seemed too easy and hardly worth a full article. Then I remembered that I had considered adding such a feature to one of my apps, but had never gotten around to doing it. Perhaps I could kill two birds with one stone—write the article and create code I could use myself down the road.

As I began to explore this particular problem, however, I discovered that it's not so easy. In fact, it's darn tricky and very worthy of an article!

I'll preface this by pointing out some caveats to my solution. Please understand that this isn't finished and has some serious limitations. (For example: the code is not yet cross-platform and focuses on the Mac, though it should be easy to make a few modifications to support Windows. Supporting both is more complicated, however.)

Think of what I show you as a proof of concept instead of complete code you can pop into your own projects. It should still serve as a good starting point, however, and alert you to some of the issues you'll run into.

What Are Keyboard Shortcuts?

To begin with, it might be good to define what we mean when we say "keyboard shortcut." The most common example are menu commands: most have a shortcut associated with them so you can hit a combination of keys to execute that command without having to mouse to the menu.

...End of Excerpt. Please purchase the magazine to read the full article.