home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / numhdl.zip / NUMERIC.CPP next >
Text File  |  1993-09-29  |  2KB  |  32 lines

  1. /**************************************************************************/
  2. /* class NumericHandler                                                           */
  3. /* Change History:                                                        */
  4. /* Rel Programmer        Stamp Date     Description                       */
  5. /* --- ----------------- ----- -------- --------------------------------- */
  6. /* 1.0 Drew Frantz       AFF   09/29/93 Creation                          */
  7. /* A simple numeric handler that is subclassed from the an                */
  8. /* IKeyboardhandler. This handler can be attached to IEntryfield instances*/
  9. /*    to only permit the entry of numeric characters within the field          */
  10. /* (c) Campbell Soup Co. 1993                                                          */
  11. /* CIS: 70712,3547                                                                          */
  12. /**************************************************************************/
  13. #include "numeric.hpp"
  14. // ===================================================================
  15. NumericHandler::NumericHandler() : IKeyboardHandler()
  16. {
  17. }
  18. // ===================================================================
  19. Boolean NumericHandler::characterKeyPress(IKeyboardEvent& keyevt)
  20. {
  21.     // returning false continues through the hdlr tree
  22.     // "         true stops at this hdlr.
  23.     // if I enter a numer it will display it in the Entryfield
  24.     // if it is not a numer it won't ..
  25.     if(keyevt.character() <= '9' && keyevt.character() >= '0')
  26.         return(false);  
  27.     else
  28.         return(true);
  29.     
  30. }
  31. // ===================================================================
  32.