home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / dovetail.zip / efield.cc < prev    next >
C/C++ Source or Header  |  1994-04-07  |  1KB  |  55 lines

  1. #include "efield.h"
  2.  
  3. Efield::Efield(HWND hParent, ULONG ulId) : Control(hParent, ulId)
  4. {
  5. }
  6.  
  7. Efield::Efield(HWND hParent, ULONG ulId,
  8.         SHORT xp, SHORT yp, SHORT dx, SHORT dy, ULONG ulStyle) : Control()
  9.    {
  10.     //  Create a simple entry field.
  11.  
  12.    hWnd = WinCreateWindow(
  13.               hParent,       /* Parent Window Handle */
  14.               WC_ENTRYFIELD,     /* Entry Field Window class name */
  15.               NULL,     /* No Window Text */
  16.               ulStyle,
  17.               xp,   /* Xcoord */
  18.               yp,   /* Ycoord */
  19.               dx,   /* Width */
  20.               dy,    /* Height */
  21.               hParent,       /* Owner Window Handle */
  22.               HWND_TOP,      /* Sibling Window Handle */
  23.               ulId,     /* Slider Window ID */
  24.               (PVOID)NULL,     /* Control Data Structure */
  25.               (PVOID)NULL);  /* no presentation parameters */
  26.    fCreated = TRUE;
  27. }
  28.  
  29. // return text of entry field
  30.  Efield::operator char *()
  31. {
  32.   int length;
  33.   char *text;
  34.  
  35.   length = WinQueryWindowTextLength(hWnd);
  36.   text = new char[length+1];
  37.   WinQueryWindowText(hWnd,length+1,(PSZ) text);
  38.   return text;
  39. }
  40.  
  41. VOID Efield::SetText(char *text)
  42. {
  43.   WinSetWindowText(hWnd,(PSZ) text);
  44. }
  45.  
  46. VOID Efield::Clear()
  47. {
  48.    WinSendMsg(hWnd, EM_CLEAR, (PVOID) NULL,(PVOID) NULL);
  49. }
  50.  
  51. VOID Efield::SetLength(ULONG ulLength)
  52. {
  53.    WinSendMsg(hWnd, EM_SETTEXTLIMIT, (MPARAM) ulLength,(MPARAM) 0);
  54. }
  55.