View Single Post
Old 11-06-2006, 07:59 PM   #1
forcedfx
Knows Where the Search Button Is
 
Join Date: Nov 2006
Model: 8310
Carrier: AT&T (formerly Cingular)
Posts: 47
Default Trying to restrict characters entered into a BasicEditField control

Please Login to Remove!

I've been racking my brain trying to figure this out for two days now.

I have a BasicEditField buit into a MainScreen that is used for entering the MAC address of a network adapter.

The field is only supposed to accept the characters 0-9, a-f, and A-F. What I want to do is grab each character as the user enters it and decide whether to keep it or discard it. None of the pre-defined Filters will work for this field. Is there a way to create my own filter? That would be ideal.

Anyway, I tried overriding the keyChar, keyDown, and keyControl events but none of them seem to give me what I want. The keyChar event is not being called when I enter letters or numbers into the BasicEditField, but when I press the backspace key it does work. And I don't think keyDown and keyControl are what I need.

All of the documentation I've read on this event seems to state that it will report each character that is entered.

I've also tried using a FieldChangeListener to examine the text every time it changes, but it's a cumbersome process and still doesn't work the way I want it to.
Offline