home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
OS/2 Shareware BBS: 10 Tools
/
10-Tools.zip
/
entryf.zip
/
EFTYPES.HPP
< prev
next >
Wrap
C/C++ Source or Header
|
1994-05-23
|
3KB
|
95 lines
/*******************************************************************
*
* Entry field types
*
*******************************************************************/
#include <ientryfd.hpp>
#include <idate.hpp>
#include <ifocshdr.hpp>
#include <ikeyhdr.hpp>
#include <ikeyevt.hpp>
/*******************************************************************
*
* N O T E _- - I only implement one type of constructor
* these should have all entry field constructors reimplemented
* and pass the intial values to the real IEntryField
* Just use these fields in place of IEntryField and all works
* fine.
* e.g.
* EDate * DateOfBith;
* EPhone * HomePhone;
* EUEntryField * Name; // convert to upper case
* ENumeric * Balance;
* DateOfBirth = new EDate(ID,Window); // assuming you built from an existing resource
* now each time you leave DateOfBirth the field will be validated
*******************************************************************/
class EDate :public IEntryField, private IFocusHandler
{
public:
EDate(unsigned long id,
IWindow* parent);
protected:
virtual Boolean lostFocus ( IControlEvent& event );
};
class EPhone :public IEntryField, private IFocusHandler
{
public:
EPhone(unsigned long id,
IWindow* parent);
protected:
virtual Boolean lostFocus ( IControlEvent& event );
};
/*******************************************************************
*
* convert the input to upper case
* Can not convert to upper case while typing because the
* IKeyboardEvent does not allow us to change the char.
* Hope IBM will fix this soon
*******************************************************************/
class EUEntryField :public IEntryField, private IFocusHandler
{
public:
EUEntryField(unsigned long id,
IWindow* parent);
protected:
virtual Boolean lostFocus ( IControlEvent& event );
};
/*******************************************************************
*
* Validate input as keys are pressed
* This routine allows the decimal point (or any number of them)
* the routine does not allow a negative sign (my function I can do what I want)
* to make an integer field either add a user function
* or build another.
*******************************************************************/
class ENumeric : public IEntryField,private IKeyboardHandler
{
protected:
virtual Boolean characterKeyPress(IKeyboardEvent &event);
public:
ENumeric(unsigned long id,
IWindow* parent);
};