Search PalmPower's 487 Palm-related article archive 
Home
EasyPrint
News details Click here for the RSS feed's XML code. This is not a browser URL.
Articles-only Click here for the RSS feed's XML code. This is not a browser URL.
Playing the field (continued)

When a field is tapped, that field is selected. From that point on, until the form is closed or you select another field, any Graffiti or keyboard characters go into that field.

Looking at the Infield sample
As I mentioned, Infield began as the "Hello, world" program. I added:

  • changes to the user interface; the field itself and several push-buttons;
  • several "library" routines in the beginning;
  • handlers for the push-buttons (ctlSelectEvent);
  • keyDownEvent handler for "special effects";
  • nilEvent handler to do some post-field change processing;
  • EventLoop changed to get nilEvents;
  • change to form's frmOpenEvent to set default push-button setting and select the field.

Let's look at each of these. You can see a listing at http://www.component-net.com/pp-extras/field.html.

User interface changes
Well, obviously if we're going to use a field, we need to have one -- so I added the field itself. I defined it as a maximum of 20 characters, underlined, usable, editable, and a single line.

I also defined a group of three push-buttons. These allow the user to filter out characters, setting the field to allow any characters, forcing alphabetic characters to upper case, or only allowing numeric characters.

Included "library" routines
For convenience, I've kept everything in a single source file. As these samples are small, I find it convenient to deal with just one listing. In reality, the routines such as toupper, isnumeric, and isprintable are in a library. These routines do just what you'd expect -- at least when using English characters; they take the US-centric view of the ASCII character set -- and I apologize to our international readers.

Handling the Push-buttons
Tapping the push-buttons generate (amongst other events) a ctlSelectEvent. This indicates the particular control has been selected. I added ctlSelectEvent handlers for the push-buttons to MainFormHandleEvent. Each push-button control sets or clears the two global boolean flags, fForceUpper and fNumericOnly. The keyDownEvent handler uses these flags to force characters to upper case or filter non-numerics.

The keyDownEvent handler
This is a bit unusual -- fields normally do keyDownEvent handling on their own. I put it in to demonstrate some additional techniques. We can modify the event before the default handler gets it, as we do when fForceUpper is set. When we're forcing upper-case characters, we check the character in the keyDownEvent structure. If it's an alphabetic character, we force it to upper case, then allow the default handler to process it. If the fNumericOnly flag is set, we do similar checking for numeric characters. In this case, if the character is not a number, we return "handled" -- so the default handler won't process the event at all.

This technique isn't perfect, though. It works for characters entered by Graffiti, but if the user enters characters via the on-screen keyboard, those characters are stuffed right into the field's data -- they don't go through the keyDownEvent processing. I have neither Jot, T9, nor the GoType! keyboard, so I couldn't check if they will work with keyDownEvent processing or not.


« Previous  ·  1  ·  2  ·  3  ·  4  ·  Next »
Other articles you might like
Home > Phones and PDAs > Palm and Treo > Programming (24 articles)
   How PDA software is born
   Program with Simplicity
   Kinectivity 2.0 brings enterprise application developers new tools
Get Weekly Email Updates
Subscribe to our regular weekly email newsletter. It's packed with tips, reviews, deep analysis, and the latest news.
 
Other PalmPower Articles
Palm gets up to date with new Tungsten family of handhelds
Create handwritten email with riteMail
Presenter-to-Go puts PowerPoint presentations on your Palm OS handheld
Looking for the cutting edge
Gain remote access to databases and PLCs
PalmSource Open House showcases what's new in the Palm community
Analysis: handheld market share
More from the ZATZ journals
Computing Unplugged: The iPad defenders have spoken
David Gewirtz Online: CNN commentary and analysis
DominoPower: Application development, William Shatner, and the origin of the universe
OutlookPower: More about disappearing text
-- Advertisement --

SECURE YOUR SITE WITH AN IRONCLAD SSL CERTIFICATE
An IronClad SSL Certificate helps you build an impenetrable fortress around your customer's credit card information. IronClad SSL Certificates are:

  • Fully validated
  • Up to 256-bit encryption
  • Up to 10 years validity
  • Stringent authentication
  • Around-the-clock customer support

Build trust. Protect your customers. Grow your online business.

Tap here now and be IronClad with SSL tonight.

ZATZ Home  ·  News  ·  Back Issues  ·  Credits/Trademarks ·  Link To Us
Copyright © 1998-2010, ZATZ Publishing. All rights reserved worldwide.
Editor's Login