At 06:03 AM 5/22/2004, you wrote:
Greetings,

In POSE (3.5) I am able to mask the characters typed into a password field by intercepting the character on keyDownEvent and converting it to a '*' before returning false and letting the system draw the character. Here's the code:

case keyDownEvent:
fieldPtr = FrmGetObjectPtr(frmP,FrmGetObjectIndex(frmP, LoginPasswordField));
if (FrmGetObjectIndex(frmP, LoginPasswordField) == FrmGetFocus(frmP)) {
inChar = eventP->data.keyDown.chr;
if (isalnum(inChar)) {
pwdIndex = FldGetInsPtPosition(fieldPtr);
gPassword[pwdIndex] = inChar;
if (gPswdMasked) {
eventP->data.keyDown.chr = '*';
}
} else if (inChar == '\b') { // handle backspace
pwdIndex = FldGetInsPtPosition(fieldPtr);
gPassword[--pwdIndex] = '\0';
}
}
handled = false;
break;


This works correctly in POSE but when I run it on my Tungsten|E it behaves as if gPswdMasked is always false.

Palm OS 5 does not let you alter an event while you're code is handling it. In your code, you modify the eventP->data.keyDown.chr field and then pass that event on to the OS. However, the event structure you're modifying is a "shadow" of the real ARM structure that the OS uses, and your change isn't be propagated from the shadow structure into the ARM version.


Since POSE only runs 68K versions of Palm OS, you're able to run this code there.

-- Ben Combee, DTS technical lead, PalmSource, Inc.
   Read "Combee on Palm OS" at http://palmos.combee.net/



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

Reply via email to