[Classes] [Prev] [Next] [Methods]

CPasswordEdit

Methods Index

Heritage
Description
Usage
Public Methods

CPasswordEdit


Heritage

Superclass: NEditControl

Subclass: None


Description

CPasswordEdit provides a native password-type text control. It uses a special validator (see CValidatorFactory and CValidator to filter keystrokes at the PTK level. Use GetTitle() to get the password or use TDI, as in the example below, to continually advise an object of the password. You can specify a character as the password character (by default: "*"). This is the character that appears in the edit control as the user types the password. You can also specify the maximum length of the password. If the user exceeds this length, the extra characters are ignored. CPasswordEdit is copy/paste safe; the user cannot copy the password from the edit field and paste it somewhere else where it might be visible.


Usage

The following example creates a password edit and connects it, using TDI, to another edit field where the password will appear as it is typed.

#include CPasswordEdit_i

CRect aFrame( 5, 110, 5 + 95, 110 + 30 );

// Create password control
itsCPasswordEdit = new CPasswordEdit( this, aFrame );

// Static text
aFrame += CPoint( aFrame.Width() + 10, 0 );
aFrame.Width( 50 );
new NText( this, aFrame, "Shhh! >" );

// Edit field to show the password as its typed
aFrame += CPoint( aFrame.Width() + 10, 0 );
aFrame.Width( 95 );
NEditControl *itsEditControl = new NEditControl( this, aFrame );

// Hook them up w/ TDI
CTdiConnection( itsCPasswordEdit, itsEditControl );

Public Methods

CPasswordEdit(CSubview* theEnclosure, 
const CRect& theRegion, // As in
NEditControl
const CStringRW& theSubstitute = "*", // Password character
int theMaxLength = 8, // Max length of password
const CStringRW& theTitle = NULLString, // Prompt string
long theAttributes = 0L); // As in NEditControl
CPasswordEdit(CSubview* theEnclosure,
long theContainerId,
long theId,
const CStringRW& theSubstitute = "*", // Password character
int theMaxLength = 8); // Max length of password
CPasswordEdit(const CPasswordEdit& theEditControl);
virtual ~CPasswordEdit();
CPasswordEdit& operator=(const CPasswordEdit& theEditControl);
virtual const CStringRW GetTitle( ) const;


[Classes] [Prev] [Next] [Methods]

support@xvt.com


Visit our online help desk for tech support

Copyright © 2009, Providence Software Solutions Inc. All rights reserved.