ebmDevMag.com home
ebm Developer's Magazine
links

developer's mag
main page

article
part 1
part 2
part 3
part 4
part 5
part 6
part 7
part 8


5 - The Amazing Phantom Keys

While playing with the program, you'll find something odd happens from time to time. For example, try to write the letter 'x' - quite likely you'll get the following messages displayed:
  code 0x006c='l'
  code 0x0008='K_BACKSPACE'
  code 0x0078='x'
This may vary (for instance, if your first stroke of the 'x' goes from bottom to top you may get a comma instead of 'l') but in either case the point is that the two strokes are interpreted separately, since the program can't be sure that the user is entering one letter or another until the second stroke. The compromise is to assume 'l' until the second stroke, and then transmit the editing characters necessary to change the selection, using backspace.

If you instead do this after setting the edit control into focus, you'll see none of this, since that control takes care of all the processing, and simply displays 'x'. The GUI controls handle this processing without effort, but you will need to remember this if you decide to write a custom text entry object from scratch. And if this seems unusual, it is - unlike handhelds such as the Palm, which require you to learn their single-stroke 'graffiti' language for text entry, this programming trick allows the ebm to process multiple stroke natural letters, avoiding the necessity of learning yet another language...

Previous Section
Next Section

Copyright © 2001-2006 ebmDevMag.com - Legal Notice