Dana Long wrote:
My application has a log in screen and requires the option of masking the password field. Since I see no way of getting this behaviour for free from a Field object, I've gone down the road of intercepting the keydown event, storing the character in an array, replacing the character with a '*' like this: eventP->data.keyDown.chr = '*' and returning false so the system updates the field.

This works great until the user puts the insertion point somewhere other than the end of the text and hits backspace or enters new text or highlights text and pastes text and... well the list seems to keep growing as I figure out how to deal with each user action.

I feel like I'm reinventing the wheel here (and so far my wheel is less than round...) Is there a better way?

Not really. Unfortunately, this seems to be a wheel that needs to be reinvented. My suggestion is whatever you do, make it easy to use next time you need it. Here are some previous suggestions from this group:


1) Disable the most disruptive feature. Do you need to allow the user to copy and paste? You can force the cursor to the end of the field and allow only adding to or removing from the end. IMO, this is the easiest as how often are people doing anything other than typing in their password?

2) Duplicate all normal field functionality for your password field. This requires a lot of work, but if you can make it reusable, it's easy next time you need it.

3) create a font w/ all '*' and set a regular field to use it. This is not my favorite solution (admittedly b/c I don't know how to do it) but it may work for you.

--
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to