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 15 in printed book and digital formats -- plus a one-year subscription 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 3.4


Mouse Gestures

Issue: 3.4 (March/April 2005)
Author: Joe Strout
Author Bio: Joe Strout occasionally worked with mice and rats in his previous life as a neuroscientist, but never trained them to gesture.
Article Description: No description available.
Article Length (in bytes): 15,795
Starting Page Number: 16
Article Number: 3410
Resource File(s):

Download Icon 3410.zip Updated: 2013-03-11 19:07:58

Related Web Link(s):


Excerpt of article text...

A "gesture" is a way of issuing a command to a computer or application by moving something -- typically a mouse or digital pen -- in a certain way. Gestures have a long history in the computing world, dating back at least to the Newton, and are still popular today in tablet PCs. Even with a mouse rather than a pen, many users feel that gestures are a much easier and more efficient way to interact with an application, especially in cases where you use the mouse much more than the keyboard -- for example, a drawing application or web browser.

Gestures should be defined in ways that are easy to remember. For example, a swipe to the left might mean "Go Back" while a swipe to the right means "Forward." A scribble over an object could mean "Delete This." Sometimes a gesture is really a letter: a letter "O" could stand for "Open" while a "C" might stand for "Close." Figure 1 shows some other sample gestures; the possibilities are endless.

If you're writing a mouse-intensive application, you should consider adding support for gestures too. You'll need some way to detect when a gesture has begun -- typically, this involves either a different mouse button, or a modifier key. Then you track the mouse during the drag, and when it's done, you match the stroke traced by the mouse to your set of gestures, and execute the corresponding command.

That's all there is to it, so have fun, and let me know how it goes... No, seriously though, we've glossed over the difficult part. No user can stroke exactly the same path twice, so how exactly do you match the stroke of the mouse to one of the gestures in a set? That's an artificial intelligence (AI) problem, in the general category of pattern matching. While you and I can look at a stroke and easily tell whether it's an "O" or a scribble, getting a computer to do the same task is much harder.

Fortunately, there is a fairly simple approach that works wonders on this particular pattern-matching problem. We'll also consider some ways that a similar approach might be used for other pattern-matching problems.

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