01-16-2009 06:40 PM
01-17-2009 03:58 AM
I use the password instrument in almost every application I write, and never saw such a problem. I use a more simplistic approach, though, which you could try to check your environment:
1. Since username and password max lenght is not subject to change during program life, I set the corresponding max lenght in the string controls of the login panel
2. I don't try to automatically advance from one field to the next: let the user use the mouse or TAB key instead
3. To use the below discussed approach, all controls on the login panel MUST be set as "Normal" with the exception of "Ok" and "Cancel" buttons
This is the code for handling all login procedure (e.g. in a callback for starting a test):
int ctrl, tmpH = 0;
char msg[512];
// Load the panel and customize password string control
tmpH = LoadPanel (0, UIR, pswd);
PasswordCtrl_ConvertFromString (tmpH, pswd_pswd);
// Install the panel as modal popup
InstallPopup (tmpH);
// Handle user events
while (TRUE) {
GetUserEvent (1, 0, &ctrl); // Wait for next commit event
if (ctrl == pswd_quit) // User pressed "Cancel" button
break;
else if (ctrl == pswd_ok) {
// ** Add code to check username **
errChk (PasswordCtrl_GetAttribute (tmpH, pswd_pswd, ATTR_PASSWORD_VAL, msg));
if (strcmp (password, msg))
MessagePopup ("Warning!", "Incorrect password entered!");
else
break;
}
}
// Remove panel
DiscardPanel (tmpH); tmpH = 0;
if (ctrl == pswd_quit) goto Error;
// The rest of your code here
Error:
// Finalization of the routine: discard dynamic memory, deallocate resources and so on
return 0;
01-21-2009 05:40 PM
01-23-2009 08:28 AM
Hello,
Does your repost indicate that the problem persists?
01-23-2009 11:37 AM
Hello,
I faced the problem you are facing over one year ago. To solve the problem of "... password is not getting masked with the "*" character ..." I did a lot of experimentation. I finally got it to work when I changed the maskChar to '*\0'. So, in your case I would suggest you use the statement below:
PasswordCtrl_SetAttribute (giLoginPanel, giPasswordCtrlID,
ATTR_PASSWORD_MASK_CHARACTER, '*\0'); // maskChar is replaced by '*\0'. Note that it is one quote (not double quotes).
Asterisks (*) would now show up as your masking character.
(NOTE: When you run your application, you would get the warning "Excess characters in multibyte character literal ignored". Ignore this warning. Your application would run fine).
Let me know how things go.
Robert Mensah