home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / entryf.zip / EFTYPES.HPP < prev    next >
C/C++ Source or Header  |  1994-05-23  |  3KB  |  95 lines

  1. /*******************************************************************
  2. *
  3. *  Entry field types
  4. *
  5. *******************************************************************/
  6. #include <ientryfd.hpp>
  7. #include <idate.hpp>
  8. #include <ifocshdr.hpp>
  9. #include <ikeyhdr.hpp>
  10. #include <ikeyevt.hpp>
  11.  
  12.  
  13.     
  14. /*******************************************************************
  15. *
  16. *  N O T E _- - I only implement one type of constructor
  17. *  these should have all entry field constructors reimplemented
  18. *  and pass the intial values to the real IEntryField
  19. *  Just use these fields in place of IEntryField and all works
  20. *  fine.  
  21. *  e.g. 
  22. *    EDate * DateOfBith;
  23. *    EPhone * HomePhone;
  24. *    EUEntryField * Name;        // convert to upper case
  25. *  ENumeric * Balance;
  26. *    DateOfBirth = new EDate(ID,Window);    // assuming you built from an existing resource
  27. *    now each time you leave DateOfBirth the field will be validated
  28. *******************************************************************/
  29.  
  30.  
  31. class EDate :public IEntryField, private IFocusHandler
  32. {
  33. public:
  34.     EDate(unsigned long id,
  35.               IWindow* parent);
  36.  
  37. protected:
  38.     virtual Boolean lostFocus ( IControlEvent& event );
  39. };
  40.  
  41.  
  42. class EPhone :public IEntryField, private IFocusHandler
  43. {
  44. public:
  45.     EPhone(unsigned long id,
  46.               IWindow* parent);
  47.  
  48. protected:
  49.     virtual Boolean lostFocus ( IControlEvent& event );
  50. };
  51.  
  52.  
  53. /*******************************************************************
  54. *
  55. *  convert the input to upper case
  56. *  Can not convert to upper case while typing because the 
  57. *  IKeyboardEvent does not allow us to change the char.
  58. *  Hope IBM will fix this soon
  59. *******************************************************************/
  60.  
  61. class EUEntryField :public IEntryField, private IFocusHandler
  62. {
  63. public:
  64.     EUEntryField(unsigned long id,
  65.               IWindow* parent);
  66.  
  67. protected:
  68.     virtual Boolean lostFocus ( IControlEvent& event );
  69. };
  70.  
  71.  
  72. /*******************************************************************
  73. *
  74. *  Validate input as keys are pressed
  75. *  This routine allows the decimal point (or any number of them)
  76. *  the routine does not allow a negative sign (my function I can do what I want)
  77. *  to make an integer field either add a user function
  78. *  or build another. 
  79. *******************************************************************/
  80.  
  81.  
  82. class ENumeric : public IEntryField,private IKeyboardHandler
  83. protected:
  84.     virtual Boolean characterKeyPress(IKeyboardEvent &event);
  85.  
  86. public:
  87.     ENumeric(unsigned long id,
  88.               IWindow* parent);
  89.  
  90. };
  91.    
  92.  
  93.  
  94.