Special

Clearance Sale!

We've been publishing for over five years now and it's time to clear out our inventory of back issues, so we're slashing prices!

RBD Magazines

Check out this amazing clearance sale of all our past issues. Missing some issues? This is a great time to complete your RBD collection. Save up to 40% off the regular price of our printed back issue packages. These prices are only good until the end of the year May 2008 and supplies are limited, so place your order today.

Article Preview


Buy Now

Print:
PDF:

Feature

Got Keys?

Cross-Platform, Asynchronous Keyboard Input

Issue: 3.2 (November/December 2004)
Author: Lars Jensen
Author Bio: Lars Jensen first fretted over asynchronous keystrokes on the DEC PDP-11/70 in 1977. (Hint: use the QIO function to fake it...)
Article Description: No description available.
Article Length (in bytes): 22,754
Starting Page Number: 26
RBD Number: 3212
Resource File(s):

Download Icon 3212.sit Updated: Sunday, July 16, 2006 at 9:43 AM

Related Web Link(s):

http://developer.chaoticbox.com
http://www.terena.nl/library/multiling/ml-mua/test/kbd-maps.html
keyboard-at-ljensen.com
http://ljensen.com/rb

Known Limitations: None

Excerpt of article text...

Most keyboard handling in REALbasic is synchronous; that is, you wait for a key-related event to occur, and you handle it without knowing whether or not the key has been released by the time your code executes. However, if you're modifying the behavior of a standard control, or programming a custom control or a game, you might need to know whether a key is pressed at the moment your code is executing, without waiting for the next keyboard event. That's called asynchronous keyboard input.

A common example is using the Shift key to constrain a drag to a horizontal or vertical axis. REALbasic lets us check the status of all Shift keys as a group, using the built-in Keyboard.AsyncShiftKey function. There are similar functions for the other common modifier keys.

But what if you want to see if only the left or right Shift key is down, or check the status of an arbitrary key on the keyboard? This kind of thing can get tricky if you want your code to run on any operating system, or even on different keyboard layouts within a single operating system.

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

Article copyrighted by REALbasic Developer magazine. All rights reserved.


 


|

 


Weblog Commenting and Trackback by HaloScan.com