home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / tvision / tfield / tufield.cpp < prev   
Encoding:
C/C++ Source or Header  |  1992-03-24  |  2.5 KB  |  80 lines

  1. /*------------------------------------------------------------*/
  2. /* filename -       tufield.cpp                               */
  3. /*                                                            */
  4. /* function(s)                                                */
  5. /*                  TUpperField                               */
  6. /*------------------------------------------------------------*/
  7.  
  8. /*------------------------------------------------------------*/
  9. /*                                                            */
  10. /*    Turbo Vision Extensions -- Version 1.1.1                */
  11. /*                                                            */
  12. /*                                                            */
  13. /*    Portions Copyright (c) 1991 by Borland International    */
  14. /*    All Rights Reserved.                                    */
  15. /*                                                            */
  16. /*    TV Extensions are Copyright (c) 1992 by Michael Bonner  */
  17. /*    These extensions may be freely used by any programmer   */
  18. /*    including royalty free inclusion in any commercial      */
  19. /*    application, but any commercial rights to the source    */
  20. /*    code or object files of the Extensions are reserved.    */
  21. /*                                                            */
  22. /*------------------------------------------------------------*/
  23.  
  24. #define Uses_ipstream
  25. #define Uses_MsgBox
  26. #define Uses_opstream
  27. #define Uses_TButton
  28. #define Uses_TDeskTop
  29. #define Uses_TDialog
  30. #define Uses_TDrawBuffer
  31. #define Uses_TEvent
  32. #define Uses_TField
  33. #define Uses_TKeys
  34. #define Uses_TRect
  35. #define Uses_TStaticText
  36. #define Uses_TUpperField
  37. #define Uses_TView
  38.  
  39. #include <tv.h>
  40. #include "tfield.h"
  41.  
  42. #if !defined( __CTYPE_H )
  43. #include <ctype.h>
  44. #endif  // __CTYPE_H
  45.  
  46. #if !defined( __STRING_H )
  47. #include <String.h>
  48. #endif  // __STRING_H
  49.  
  50. #if !defined( __DOS_H )
  51. #include <Dos.h>
  52. #endif  // __DOS_H
  53.  
  54. #if !defined( __MEM_H )
  55. #include <Mem.h>
  56. #endif  // __MEM_H
  57.  
  58.  
  59. const char * const near TUpperField::name = "TUpperField";
  60.  
  61. TUpperField::TUpperField( const TRect& bounds, int aMaxLen ) :
  62.     TField(bounds, aMaxLen)
  63.     {
  64.     fieldType = TUpperFieldType;
  65.     }
  66.  
  67. inline ushort TUpperField::filterCharCode( ushort charCode) //Virtual
  68.     {
  69.     return islower(charCode) ? _toupper(charCode) : charCode;
  70.     }
  71.  
  72. void TUpperField::setData( void *rec ) //Virtual
  73.     {
  74.     memcpy( data, rec, dataSize()-1 );
  75.     data[dataSize()-1] = EOS;
  76.     strupr(data);
  77.     selectAll( True );
  78.     }
  79.  
  80.