ccEdit

09/16/99

Author: Daniel.Lindh@Home.se
ICQ: 7983755
HOMEPAGE: home.bip.net/CyberCow

Copyright © Cyber Cow 1995 - 1999.
All Rights Reserved.

OverView
Class Members
Base Class CEdit

 

Overview

#include <CEdit.h>

Hierarchy Chart

 


The ccEdit class is a CEdit derived class with masking support. It has a coupple of predefined mask types. Date, Time, Date+Time, var length text, var length numbers. It is also possible to customize a mask.

 

Class Members

Construction

Public:

ccEdit

Default Constructor

Mask definations

Public:

setCustomMask

Set a custom mask. Valid masks are '?' any char, '#' only numbers, '%' only alpha numeric.

setDateMask

The mask will look like this ####-##-## and verfiy the date to a legal date between 1901-01-01 and 9999-12-31

setTimeMask

The mask will look like this ##:##:## and verfiy the time to a legal time between 00:00:00 and 23:59:59.

setDateTimeMask

The mask will be the data and time mask together, and  will also be verifyed as the date and time masks

setTextMask

The mask will be a variable length number of chars.

setNumericMask

The mask will be a variable length number of numberic chars.

getMask

Get the current mask.

 

 

ccEdit::setCustomMask

void setCustomMask( CString asMask, char acPlaceHolder = '_' );

Return Value:

None

Arguments:

asMask

The mask. Valid masks are '?' any char, '#' only numbers, '%' only alpha numeric.

acPlaceHolder

This char will replace the mask char if nothing is typed in the ccEdit ctrl.

Remarks:

Set a custom mask. 

Example:

// header file

ccEdit m_phone;

 

// cpp file

void cccEditTextView::OnInitialUpdate() 

{

...

   m_phone.SubclassDlgItem( IDC_PHONE, this );
   m_phone.setCustomMask( "(##)-(###)-### ###" );

}

 

ccEdit::setDateMask

void setDateMask();

Return Value:

None

Arguments:

None

Remarks:

The mask will look like this ####-##-## and verfiy the date to a legal date between 1901-01-01 and 9999-12-31

Example:

// header file

ccEdit m_date;

 

// cpp file

void cccEditTextView::OnInitialUpdate() 

{

...

   m_date.SubclassDlgItem ( IDC_DATE, this );
   m_date.setDateMask();

}

 

ccEdit::setTimeMask

void setTimeMask();

Return Value:

None

Arguments:

None

Remarks:

The mask will look like this ##:##:## and verfiy the time to a legal time between 00:00:00 and 23:59:59.

Example:

// header file

ccEdit m_time;

 

// cpp file

void cccEditTextView::OnInitialUpdate() 

{

...

   m_time.SubclassDlgItem ( IDC_TIME, this );
   m_time.setTimeMask(); 

}

 

ccEdit::setDateTimeMask

void setDateTimeMask();

Return Value:

None

Arguments:

None

Remarks:

The mask will be the data and time mask together, and  will also be verifyed as the date and time masks

Example:

// header file

ccEdit m_dateTime;

 

// cpp file

void cccEditTextView::OnInitialUpdate() 

{

...

   m_dateTime.SubclassDlgItem( IDC_DATE_TIME, this );
   m_dateTime.setDateTimeMask(); 
}

 

ccEdit::setTextMask

void setTextMask(int aiLength);

Return Value:

None

Arguments:

aiLength

The number of possible chars to type into the ccEdit ctrl.

Remarks:

The mask will be a variable length number of chars.

Example:

// header file

ccEdit m_text;

 

// cpp file

void cccEditTextView::OnInitialUpdate() 

{

...

   m_text.SubclassDlgItem ( IDC_TEXT, this );
   m_text.setTextMask( 5 );
}

 

ccEdit::setNumericMask

void setNumericMask(int aiLength);

Return Value:

None

Arguments:

aiLength

The number of possible number to type into the ccEdit ctrl

Remarks:

The mask will be a variable length number of numberic chars.

Example:

// header file

ccEdit m_number;

 

// cpp file

void cccEditTextView::OnInitialUpdate() 

{

...

   m_number.SubclassDlgItem( IDC_NUMBER, this );
   m_number.setNumericMask( 5 );
}

 

ccEdit::getMask

CString getMask();

Return Value:

CString

Returning the the current mask.

Arguments:

None

Remarks:

Get the current mask.

Example:

// header file

ccEdit m_number;

 

// cpp file

...

   CString lsMask = m_number.getMask();

...