home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD2.mdf / c / library / dos / tvision / tfield / tfield.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1992-03-25  |  17.5 KB  |  743 lines

  1. /*------------------------------------------------------------*/
  2. /* filename -       tfield.cpp                                */
  3. /*                                                            */
  4. /* function(s)                                                */
  5. /*                  TField member functions                   */
  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_TIntField
  34. #define Uses_TKeys
  35. #define Uses_TRect
  36. #define Uses_TStaticText
  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 int CONTROL_Y = 25;
  60.  
  61. char hotKey( const char *s )
  62.     {
  63.      char *p;
  64.  
  65.      if( (p = strchr( s, '~' )) != 0 )
  66.           return toupper(p[1]);
  67.      else
  68.           return 0;
  69.     }
  70.  
  71. #define cpField "\x13\x13\x14\x15"
  72.  
  73.  
  74. const char * const near TField::name = "TField";
  75. const char near TField::rightArrow = '\x10';
  76. const char near TField::leftArrow = '\x11';
  77.  
  78.  
  79. TField::TField( const TRect& bounds, int aMaxLen ) :
  80.     TView(bounds),
  81.     data( new char[aMaxLen] ), // note initialization to [aMaxLen] which is
  82.     maxLen( aMaxLen - 1 ),        // maxLen + 1 so later data[maxLen] = EOS
  83.     curPos( 0 ),                    // is valid!
  84.     firstPos( 0 ),
  85.     selStart( 0 ),
  86.     selEnd( 0 ),
  87.     tfOptions( 0 ),
  88.     hideChar( 0 ),
  89.     securityChar( '*' ),
  90.     fieldSecurity( 0 ),
  91.     currentSecurity( 0 ),
  92.     fieldType( TFieldType )
  93.     {
  94.      state |= sfCursorVis;
  95.      options |= ofSelectable | ofFirstClick | ofPreProcess | ofPostProcess;
  96.      eventMask |= evBroadcast;
  97.  
  98.      fieldName = fieldHint = NULL;
  99.  
  100.      *data = EOS;
  101.      dataChanged = False;
  102.     }
  103.  
  104. TField::~TField()
  105.     {
  106.     delete data;
  107.  
  108.     if ( fieldName != NULL )
  109.         delete fieldName;
  110.  
  111.     if ( fieldHint != NULL )
  112.         delete fieldHint;
  113.     }
  114.  
  115. Boolean TField::canScroll( int delta ) //Private
  116.     {
  117.     if( (tfOptions & tfNoScroll) != 0)
  118.         return False;
  119.     else
  120.         {
  121.         if( delta < 0 )
  122.             return Boolean( firstPos > 0 );
  123.         else
  124.             if( delta > 0 )
  125.                 return Boolean( strlen(data) - firstPos + 2 > size.x );
  126.             else
  127.                 return False;
  128.         };
  129.     }
  130.  
  131. void TField::convertData( void ) //Virtual
  132.     {
  133.     dataChanged = False;
  134.     }
  135.  
  136. ushort TField::dataSize() //Virtual
  137.     {
  138.      return maxLen+1;
  139.     }
  140.  
  141. void  TField::deleteSelect() //Private
  142.     {
  143.     if( selStart < selEnd )
  144.         {
  145.         strcpy( data+selStart, data+selEnd );
  146.         curPos = selStart;
  147.         };
  148.     }
  149.  
  150. void TField::draw() //Virtual
  151.     {
  152.     const int bufferSize = 256;
  153.  
  154.     int     selectFirst = 0,             // formerly l,
  155.                                             // used to calc position of the first
  156.                                             // selected character in the TDrawBuffer
  157.             selectLast = 0,            // formerly r,
  158.                                             // used to calc position of the last
  159.                                             // selected character in the TDrawBuffer
  160.             dataLen = strlen(data),    // holds the length of the data string
  161.             cursorPosition = 0,        // holds the new cursor postion
  162.             displaySize = size.x,    // holds the # characters of the current
  163.                                             // TRect which will be used to display data
  164.             dataOffset = firstPos,    // holds the offset into the data string
  165.             bufOffset = 0,                // holds the offset into the buf buffer
  166.                                             // used w/ jRight to add leading spaces
  167.             bOffset = 0;                // holds the offset into the b buffer
  168.                                             // used w/ scrollState to leave room for
  169.                                             // leftArrow
  170.  
  171.     TDrawBuffer b;
  172.  
  173.     uchar color = (state & sfFocused) ? getColor( 2 ) : getColor( 1 );
  174.  
  175.     // clear the display buffer
  176.     b.moveChar( 0, ' ', color, size.x );
  177.  
  178.     char buf[bufferSize]; // create a temporary character buffer
  179.     memset(buf, ' ', (size.x > bufferSize) ? bufferSize : size.x); // clear the buffer
  180.  
  181.     if ( (tfOptions & tfNoScroll) == 0 )
  182.         {
  183.         bOffset = 1;                     // leave room for the left arrow at the
  184.                                             // start of the line
  185.         displaySize -= 2;             // adjust display size to leave room for
  186.                                             // two arrows on the line
  187.  
  188.         if (    ((state & sfSelected) != 0 ) &&
  189.                 ((state & sfFocused) != 0 ) )
  190.             {
  191.             if( canScroll(1) )
  192.                 b.moveChar( size.x-1, rightArrow, getColor(4), 1 );
  193.             if( canScroll(-1) )
  194.                 b.moveChar( 0, leftArrow, getColor(4), 1 );
  195.             };
  196.         };
  197.  
  198.     if ( ((tfOptions & tfRight) != 0 ) && (dataLen <= displaySize) )
  199.         {
  200.         bufOffset = displaySize - dataLen;
  201.         if (maxLen < displaySize)
  202.             bufOffset--;
  203.         };
  204.  
  205.     if ( (state & sfSelected) != 0 )
  206.         {
  207.         selectFirst = selStart - firstPos;
  208.         selectLast = selEnd - firstPos;
  209.         selectFirst = max( 0, selectFirst ) + bufOffset;
  210.         selectLast = min( displaySize, selectLast ) + bufOffset;
  211.         cursorPosition = curPos - firstPos + bOffset + bufOffset;
  212.         };
  213.  
  214.  
  215.     if ( hideChar < ' ' )
  216.         // Check for a securityChar situation
  217.         if ( ((tfOptions & tfHideSecure) != 0) &&
  218.                 (currentSecurity > fieldSecurity) )
  219.             // We have a security situation so we need to mask the string
  220.             strnset(buf+bufOffset, securityChar , min(displaySize, dataLen-dataOffset) );
  221.         else
  222.             strncpy( buf+bufOffset, data+dataOffset, min(displaySize, dataLen) );
  223.     else
  224.         strnset(buf+bufOffset, hideChar , min(displaySize, dataLen-dataOffset) );
  225.  
  226.     if (bufOffset > 0)
  227.         buf[ displaySize ] = EOS;
  228.     else
  229.         buf[ min(displaySize, dataLen) ] = EOS;
  230.  
  231.     b.moveStr( bOffset, buf, color );
  232.  
  233.     if (selectFirst <  selectLast)
  234.         b.moveChar( selectFirst + bOffset, 0, getColor(3),
  235.                         min(selectLast - selectFirst, dataLen) );
  236.  
  237.     writeLine( 0, 0, size.x, size.y, b );
  238.  
  239.     setCursor( cursorPosition > size.x ? size.x : cursorPosition, 0);
  240.  
  241.     }
  242.  
  243. ushort TField::filterCharCode( ushort charCode ) //Virtual
  244.     {
  245.     return charCode;
  246.     // return a 1 to selectAll( true ) the field in the handleEvent routine
  247.     }
  248.  
  249. void TField::getData( void *rec ) //Virtual
  250.     {
  251.      memcpy( rec, data, dataSize() );
  252.     }
  253.  
  254. TPalette& TField::getPalette() const //Virtual
  255.     {
  256.      static TPalette palette( cpField, sizeof( cpField )-1 );
  257.      return palette;
  258.     }
  259.  
  260. void TField::gotFocus( void ) //Virtual
  261.     {
  262.     selectAll( True );
  263.     }
  264.  
  265. void TField::handleEvent( TEvent& event ) //Virtual
  266.     {
  267.     TView::handleEvent(event);
  268.  
  269.     int delta, anchor, i, selectFlag = 0;
  270.     if( (state & sfSelected) != 0 )
  271.         switch( event.what )
  272.             {
  273.             case evMouseDown:
  274.                 if( canScroll(delta = mouseDelta(event)) )
  275.                     do
  276.                         {
  277.                         if( canScroll(delta) )
  278.                             {
  279.                             firstPos += delta;
  280.                             drawView();
  281.                             }
  282.                         }
  283.                     while( mouseEvent( event, evMouseAuto ) );
  284.                 else if (event.mouse.doubleClick)
  285.                     selectAll(True);
  286.                 else
  287.                     {
  288.                     anchor =  mousePos(event);
  289.                     do
  290.                         {
  291.                         if    (     event.what == evMouseAuto &&
  292.                                 canScroll( delta = mouseDelta(event) )
  293.                             )
  294.                             firstPos += delta;
  295.                         curPos = mousePos(event);
  296.                         if( curPos < anchor )
  297.                             {
  298.                             selStart = curPos;
  299.                             selEnd = anchor;
  300.                             }
  301.                         else
  302.                             {
  303.                             selStart = anchor;
  304.                             selEnd = curPos;
  305.                             }
  306.                         drawView();
  307.                         }
  308.                     while (mouseEvent(event, evMouseMove | evMouseAuto));
  309.                     }
  310.                 clearEvent(event);
  311.                 break;
  312.  
  313.             case evKeyDown:
  314.                 switch( ctrlToArrow(event.keyDown.keyCode) )
  315.                     {
  316.                     case kbLeft:
  317.                         if( curPos > 0 )
  318.                             curPos--;
  319.                         break;
  320.                     case kbRight:
  321.                         if( curPos < strlen(data) )
  322.                             curPos++;
  323.                         break;
  324.                     case kbHome:
  325.                         curPos =  0;
  326.                         break;
  327.                     case kbEnd:
  328.                         curPos = strlen(data);
  329.                         break;
  330.                     case kbEnter:
  331.                         if ( (tfOptions & tfEnterTabs) != 0 )
  332.                             {
  333.                             if ( (tfOptions & tfStayError) == 0)
  334.                                 owner->selectNext( False );
  335.                             else
  336.                                 if( valid(cmLeaving) )
  337.                                     owner->selectNext( False );
  338.                             }
  339.                         else
  340.                             return;
  341.                         break;
  342.                     case kbTab:
  343.                         if ( (tfOptions & tfStayError) == 0)
  344.                             owner->selectNext( False );
  345.                         else
  346.                             if( valid(cmLeaving) )
  347.                                 owner->selectNext( False );
  348.                         break;
  349.                     case kbShiftTab:
  350.                         if ( (tfOptions & tfStayError) == 0)
  351.                             owner->selectNext( True );
  352.                         else
  353.                             if( valid(cmLeaving) )
  354.                                 owner->selectNext( True );
  355.                         break;
  356.                     case kbBack:
  357.                         if( curPos > 0 )
  358.                             {
  359.                             dataChanged = True;
  360.                             strcpy( data+curPos-1, data+curPos );
  361.                             curPos--;
  362.                             if( firstPos > 0 )
  363.                                 firstPos--;
  364.                             }
  365.                         break;
  366.                     case kbCtrlBack:
  367.                         dataChanged = True;
  368.                         *data = EOS;
  369.                         curPos = 0;
  370.                         break;
  371.                     case kbDel:
  372.                         dataChanged = True;
  373.                         if( selStart == selEnd )
  374.                             if( curPos < strlen(data) )
  375.                                 {
  376.                                 selStart = curPos;
  377.                                 selEnd = curPos + 1;
  378.                                 }
  379.                         deleteSelect();
  380.                         break;
  381.                     case kbIns:
  382.                         setState(sfCursorIns, Boolean(!(state & sfCursorIns)));
  383.                         break;
  384.                     default:
  385.                         if ( processKeyCode(event.keyDown.keyCode) == 1 )
  386.                             selectFlag = 1;
  387.  
  388.                         ushort holdCharCode =
  389.                             filterCharCode(event.keyDown.charScan.charCode);
  390.  
  391.                         if( holdCharCode >= ' ' )
  392.                             {
  393.                             dataChanged = True;
  394.                             // Added fix for overlay mode suggested by
  395.                             // Martin Keye (CIS 100033,3020)
  396.                             // Line read:
  397.                             //     if ( (state & sfCursorIns ) != 0 )
  398.                             if ( ((state & sfCursorIns ) != 0) &&
  399.                                     (curPos < strlen(data)) )
  400.                                 strcpy( data + curPos, data + curPos + 1 );
  401.                             else
  402.                                 deleteSelect();
  403.  
  404.                             if( strlen(data) < maxLen )
  405.                                 {
  406.                                 if( firstPos > curPos )
  407.                                     firstPos = curPos;
  408.                                 memmove( data + curPos + 1, data + curPos,
  409.                                     strlen(data+curPos)+1 );
  410.                                 data[curPos++] = holdCharCode;
  411.                                 }
  412.                             else
  413.                                 {
  414.                                 dataChanged = False;
  415.                                 if ( (tfOptions & tfBeepError) != 0)
  416.                                     beep();
  417.                                 };
  418.                             }
  419.                         else
  420.                             {
  421.                             if( holdCharCode == CONTROL_Y)
  422.                                 {
  423.                                 dataChanged = True;
  424.                                 *data = EOS;
  425.                                 curPos = 0;
  426.                                 }; // if control_y
  427.                             if ( holdCharCode == 1 )
  428.                                 selectFlag = 1;
  429.                             };
  430.                     }; // switch
  431.                 if (selectFlag == 1)
  432.                     curPos = selEnd = strlen( data );
  433.                 else
  434.                     selStart = selEnd = 0;
  435.                 if( (maxLen == 1) && (size.x == 1) )
  436.                     firstPos = curPos = 0;
  437.                 else
  438.                     {
  439.                     if( firstPos > curPos )
  440.                         firstPos = curPos;
  441.                     i = curPos - size.x + 1;
  442.                     if ((tfOptions & tfNoScroll) == 0)
  443.                         i += 2;
  444.                     if( firstPos < i )
  445.                         firstPos = i;
  446.                     };
  447.                 drawView();
  448.                 clearEvent( event );
  449.                 break;
  450.  
  451.             case evBroadcast:
  452.  
  453.                 if (event.message.command == cmUpdateSecurity)
  454.                     setCurrentSecurity( event.message.infoWord );
  455.  
  456.                 if (     (event.message.infoPtr == this) &&
  457.                         ((state & sfExposed) != 0) )
  458.                     {
  459.                     ushort saveEvents;
  460.                     switch (event.message.command)
  461.                         {
  462.                         case cmReceivedFocus:
  463.                             saveEvents = eventMask;
  464.                             eventMask &= ~evBroadcast;
  465.                             gotFocus();
  466.                             clearEvent(event);
  467.                             eventMask = saveEvents;
  468.                             break;
  469.  
  470.                         case cmReleasedFocus:
  471.                             saveEvents = eventMask;
  472.                             eventMask &= ~evBroadcast;
  473.                             lostFocus();
  474.                             clearEvent(event);
  475.                             eventMask = saveEvents;
  476.                             break;
  477.                         };
  478.                     };
  479.             };
  480.     }
  481.  
  482. #pragma argsused
  483. Boolean TField::isValid( ushort command ) //Virtual
  484.     {
  485.     Boolean status = True;
  486.  
  487. // skeleton for overriding
  488. /*    switch (command)
  489.         {
  490.         case cmArriving:
  491.             // handle dependence based on other field's values, etc.
  492.             status = True;
  493.             break;
  494.  
  495.         case cmLeaving:
  496.             // perform custom validations
  497.             status = True;
  498.             break;
  499.  
  500.         };    */
  501.  
  502.     return status;
  503.     }
  504.  
  505. void TField::lostFocus( void ) //Virtual
  506.     {
  507.     selectAll( False );
  508.     }
  509.  
  510. int TField::mouseDelta( TEvent& event ) //Private
  511.     {
  512.     TPoint mouse = makeLocal( event.mouse.where );
  513.  
  514.     if( mouse.x <= 0 )
  515.         return -1;
  516.     else
  517.         if( mouse.x >= size.x - 1 )
  518.             return 1;
  519.         else
  520.             return 0;
  521.     }
  522.  
  523. int TField::mousePos( TEvent& event ) //Private
  524.     {
  525.  
  526.     TPoint mouse = makeLocal( event.mouse.where );
  527.     int pos;
  528.  
  529.     int    leadArrow = (((tfOptions & tfNoScroll) != 0) ? 0 : 1),
  530.                 // offset for the beginning arrow
  531.             displaySize = (((tfOptions & tfNoScroll) != 0) ? size.x : size.x - 2),
  532.                 // x size used for display
  533.             dataLen = strlen(data),                // length of the data item
  534.             jOffset = 0;                            // justification offset
  535.  
  536.     if ( ((tfOptions & tfRight) != 0) && (dataLen <= displaySize) )
  537.         {
  538.         jOffset = displaySize - dataLen;
  539.         if (maxLen < displaySize)
  540.             jOffset--;
  541.         };
  542.  
  543.     mouse.x = max( mouse.x, leadArrow );
  544.     pos = mouse.x + firstPos - jOffset - leadArrow;
  545.  
  546.     pos = max( pos, 0 );
  547.     pos = min( pos, strlen(data) + jOffset );
  548.     return pos;
  549.     }
  550.  
  551. ushort TField::processKeyCode( ushort keyCode ) //Virtual
  552.     {
  553.     return keyCode;
  554.     // return a 1 to selectAll( true ) the field in the handleEvent routine
  555.     }
  556.  
  557.  
  558. void TField::selectAll( Boolean enable )
  559.     {
  560.     selStart = 0;
  561.     if( enable )
  562.         curPos = selEnd = strlen(data);
  563.     else
  564.         curPos = selEnd = 0;
  565.  
  566.     if ((tfOptions & tfNoScroll) != 0)
  567.         if ( (maxLen == 1) && (size.x == 1) )
  568.             firstPos = 0;
  569.         else
  570.             firstPos = max( 0, curPos-size.x+1 );
  571.     else
  572.         firstPos = max( 0, curPos-size.x+3 );
  573.     drawView();
  574.     }
  575.  
  576. void TField::setCurrentSecurity( ushort newSecurityLevel ) //Virtual
  577.     {
  578.     currentSecurity = newSecurityLevel;
  579.  
  580.     if ( (tfOptions & tfHideSecure) != 0 )
  581.         if (currentSecurity > fieldSecurity)
  582.             drawView();
  583.  
  584.     }
  585.  
  586. void TField::setData( void *rec ) //Virtual
  587.     {
  588.     memcpy( data, rec, dataSize()-1 );
  589.     data[dataSize()-1] = EOS;
  590.     selectAll( True );
  591.     }
  592.  
  593. void TField::setFieldHint( char *aString ) //Virtual
  594.     {
  595.     if (fieldHint != NULL)
  596.         delete fieldHint; // free old storage
  597.  
  598.     fieldHint = newStr( aString );
  599.     }
  600.  
  601. void TField::setFieldName( char *aString) //Virtual
  602.     {
  603.     if (fieldName != NULL)
  604.         delete fieldName; // free old storage
  605.  
  606.     fieldName = newStr( aString );
  607.     }
  608.  
  609. void TField::setHideChar( char newHideChar ) //Virtual
  610.     {
  611.     hideChar = newHideChar;
  612.     drawView();
  613.     }
  614.  
  615. void TField::setTFOptions( ushort anOption, Boolean enable ) //Virtual
  616.     {
  617.     if( enable == True )
  618.         tfOptions |= anOption;
  619.     else
  620.         tfOptions &= ~anOption;
  621.  
  622.     if( (anOption & tfNoScroll) && enable )
  623.         firstPos = 0;
  624.  
  625.     drawView();
  626.  
  627.     }
  628.  
  629. Boolean TField::valid( ushort command ) //Virtual
  630.     {
  631.     Boolean status = True;
  632.  
  633.     if (dataChanged)
  634.         convertData(); // for later implementation, handle customized data types
  635.  
  636.     switch (command)
  637.         {
  638.  
  639.         case cmValid:
  640.             status = True;
  641.             break;
  642.  
  643.         case cmLeaving:
  644.             if ( (tfOptions & tfPreValidate) != 0)
  645.                 status = isValid(command);
  646.  
  647.             if (status)
  648.                 {
  649.                 if    (    ((tfOptions & tfMustFill) != 0) &&
  650.                         ( strlen(data) < maxLen )    )
  651.                     {
  652.                     status = False;
  653.                     if ((tfOptions & tfBeepError) != 0)
  654.                         beep();
  655.                     messageBox("This field must be completely filled!",
  656.                         mfWarning | mfOKButton );
  657.                     }
  658.                 else
  659.                     if (     ((tfOptions & tfNotEmpty) != 0) &&
  660.                             ( strlen(data) == 0 ) )
  661.                         {
  662.                         status = False;
  663.                         if ((tfOptions & tfBeepError) != 0)
  664.                             beep();
  665.                         messageBox("This field must contain at least 1 character!",
  666.                             mfWarning | mfOKButton );
  667.                     };
  668.                 };
  669.  
  670.             if (status)
  671.                 if ( (tfOptions & tfPreValidate) == 0)
  672.                     status = isValid(command);
  673.  
  674.             break;
  675.  
  676.         case cmArriving:
  677.             if ( (tfOptions & tfPreValidate) != 0)
  678.                 status = isValid(command);
  679.  
  680.             if (status)
  681.                 status = True;
  682.  
  683.             if (status)
  684.                 if ( (tfOptions & tfPreValidate) != 0)
  685.                     status = isValid(command);
  686.  
  687.             break;
  688.  
  689.         };
  690.  
  691.     return status;
  692.     }
  693.  
  694. void TField::write( opstream& os ) //Protected
  695.     {
  696.     TView::write( os );
  697.     os << maxLen << curPos << firstPos
  698.         << selStart << selEnd << tfOptions << hideChar
  699.         << securityChar << fieldSecurity << currentSecurity;
  700.     os.writeString( data);
  701.     os.writeString(fieldHint);
  702.     os.writeString(fieldName);
  703.     os << fieldType;
  704.     }
  705.  
  706. void *TField::read( ipstream& is ) //Protected
  707.     {
  708.     TView::read( is );
  709.     is >> maxLen >> curPos >> firstPos
  710.         >> selStart >> selEnd >> tfOptions >> hideChar
  711.         >> securityChar >> fieldSecurity >> currentSecurity;
  712.  
  713.     if ((data = new char[maxLen + 1]) != NULL)
  714.         is.readString(data, maxLen);
  715.  
  716.     char *buffer;
  717.     if ((buffer = new char[256]) != NULL)
  718.         {
  719.         is.readString(buffer, 255);
  720.         fieldHint = newStr(buffer);
  721.         is.readString(buffer, 255);
  722.         fieldName = newStr(buffer);
  723.         delete buffer;
  724.         };
  725.  
  726.     is >> fieldType;
  727.  
  728.     state |= sfCursorVis;
  729.  
  730.     options |= ofSelectable | ofFirstClick | ofPreProcess | ofPostProcess;
  731.     eventMask |= evBroadcast;
  732.     return this;
  733.     }
  734.  
  735. TStreamable *TField::build()
  736.     {
  737.     return new TField( streamableInit );
  738.     }
  739.  
  740. TField::TField( StreamableInit ) : TView( streamableInit ) //Protected
  741.     {
  742.     }
  743.