Here is a technique that I have used in the past:
- Make two identical textboxes, one on top of the other.
- The back one is the “real” password.
- The front one will only show asterisks.
- Attach the following modify_verify callback to the front (“fake”)
cfg_pw_modify_verify( PtWidget_t *widget, ApInfo_t *apinfo,
PtCallbackInfo_t *cbinfo )
PtTextCallback_t *cbs = (PtTextCallback_t *) cbinfo->cbdata;
/* eliminate ‘unreferenced’ warnings */
widget = widget, apinfo = apinfo, cbinfo = cbinfo;
/* Edit the REAL password widget */
cfg = get_user_data( widget );
PtSetArg( &args, Pt_ARG_TEXT_SUBSTRING, cbs, 0 );
PtSetResources( cfg->real_passwd_wgt, 1, args );
for( len = 0; len < cbs->length; len++ )
cbs->text[len] = ‘*’;
return( Pt_CONTINUE );
In this case, cfg->real_passwd_wgt is a PtWidget_t* to the “real”
password textbox. I had explicitly stored it in the “fake” password
textbox’s user_data pointer. Odds are you can simply use the ABW_*
manifest provided by PhAB.
Adam Williams wrote:
I have two text boxes on screen, one a username and one a password. I would
like to have the password text replaced with stars instead of displaying the
I have seen the example from the helpfile and it appears as though it
creates the widgets at runtime. I would just like a few lines of code to do
the substitution and to keep the text entered.
I would appreciate any assistance with this.
ps. PtPassword is of no use to me as I have two textboxes on a pre-made
screen. I do not want to have a separate popup screen.