{$I OVC.INC}

{$B-} {Complete Boolean Evaluation}
{$I+} {Input/Output-Checking}
{$P+} {Open Parameters}
{$T-} {Typed @ Operator}
{$W-} {Windows Stack Frame}
{$X+} {Extended Syntax}

{$IFNDEF Win32}
{$G+} {286 Instructions}
{$N+} {Numeric Coprocessor}
{$C MOVEABLE,DEMANDLOAD,DISCARDABLE}
{$ENDIF}

{*********************************************************}
{*                    OVCEF.PAS 2.00                     *}
{*     Copyright (c) TurboPower Software Co 1995-96      *}
{*                 All rights reserved.                  *}
{*********************************************************}

unit OvcEF;
  {-base entry field class}

interface

uses
  {$IFDEF Win32} Windows, {$ELSE} WinTypes, WinProcs, {$ENDIF}
  Classes, ClipBrd, Controls, Forms, Graphics, Menus, Messages, SysUtils,
  OvcBase, OvcCaret, OvcColor, OvcConst, OvcCmd,
  OvcData, OvcExcpt, OvcIntl, OvcMisc, OvcStr,
  OvcUser, OvcVer, STDate;

const
  DefAutoAdvanceChar   = False;
  DefAutoAdvanceLR     = False;
  DefAutoAdvanceUD     = False;
  DefAutoSelect        = True;
  DefAutoSize          = True;
  DefBeepOnError       = True;
  DefBorderStyle       = bsSingle;
  DefCaretToEnd        = True;
  DefCtrlColor         = clRed;
  DefDecimalPlaces     = 0;
  DefForceInsert       = False;
  DefForceOvertype     = False;
  DefHeight            = 25;
  DefHighlightBack     = clHighlight;
  DefHighlightText     = clHighlightText;
  DefInputRequired     = False;
  DefInsertPushes      = True;
  DefMaxLength         = 15;
  DefParentColor       = False;
  DefPasswordChar      = '*';
  DefPasswordMode      = False;
  DefReadOnly          = False;
  DefRightJustify      = False;
  DefSoftValidation    = False;
  DefStripLiterals     = False;
  DefTabStop           = True;
  DefTextMargin        = 2;
  DefTrimBlanks        = True;
  DefUninitialized     = False;
  DefWidth             = 130;
  DefZeroDisplay       = zdShow;
  DefZeroDisplayValue  = 0;

type
  {user validation event}
  TUserValidationEvent =
    procedure(Sender : TObject; var ErrorCode : Word)
    of object;
  TValidationErrorEvent =
    procedure(Sender : TObject; ErrorCode : Word; ErrorMsg : string)
    of object;

  {abstract entry field class}
  TOvcBaseEntryField = class(TOvcBase)
  {.Z+}
  protected {private}
    {property instance variables}
    FAutoAdvanceChar   : Boolean;      {focus moves to next field after last character entered}
    FAutoAdvanceLR     : Boolean;      {L/R cursor movement at field ends moves focus to next/prev control}
    FAutoAdvanceUD     : Boolean;      {U/D cursor movement moves focus to next/prev control}
    FAutoSelect        : Boolean;      {select all text when gets focus}
    FAutoSize          : Boolean;      {size control when font changes}
    FBeepOnError       : Boolean;      {MessageBeep is called for error conditions}
    FBorderStyle       : TBorderStyle; {border around the edit field}
    FCaretToEnd        : Boolean;      {caret is placed at end of string}
    FCtrlColor         : TColor;       {control character foreground color}
    FDecimalPlaces     : Byte;         {max decimal places, if no '.' in Picture}
    FEpoch             : Integer;      {combined epoch year and cenury}
    FErrorColors       : TOvcColors;   {colors for invalid fields}
    FHighlightColors   : TOvcColors;   {background and text highlight colors}
    FInputRequired     : Boolean;      {field cannot be left empty by the user}
    FInsertPushes      : Boolean;      {inserted chars push ending chars off}
    FIntlSup           : TOvcIntlSup;  {international support object}
    FForceInsert       : Boolean;      {forces insert mode while editing}
    FForceOvertype     : Boolean;      {forces overtype mode while editing}
    FLastError         : Word;         {result of last validation}
    FMaxLength         : Word;         {maximum length of string}
    FPadChar           : AnsiChar;     {character used to pad end of string}
    FPasswordChar      : AnsiChar;     {character used in password mode}
    FPasswordMode      : Boolean;      {use password mode}
    FReadOnly          : Boolean;      {prevents field editing}
    FRightJustify      : Boolean;      {display text right-justified}
    FSoftValidation    : Boolean;      {errors detected are not reported, just flagged}
    FStripLiterals     : Boolean;      {remove literals from returned string}
    FTextMargin        : Integer;      {indent from left (right)}
    FTrimBlanks        : Boolean;      {remove leading and trailing blanks if not listerals}
    FUninitialized     : Boolean;      {the field isblanked out completely except when it has the focus}
    FUserData          : TOvcUserData; {field mask and data object}
    FZeroDisplay       : TZeroDisplay; {true to display an empty field}
    FZeroDisplayValue  : Double;       {value used by ZeroDisplay logic}

    {event variables}
    FOnChange          : TNotifyEvent;
    FOnError           : TValidationErrorEvent;
    FOnUserCommand     : TUserCommandEvent;
    FOnUserValidation  : TUserValidationEvent;

    {internal variables}
    efCaret            : TOvcCaretPair; {our carets}
    efDataSize         : Word;          {size of data type being edited}
    efDataType         : Byte;          {code indicating field type}
    efEditSt           : TEditString;   {the edit string}
    efFieldClass       : Byte;          {fcSimple, fcPicture, or fcNumeric}
    efHOffset          : Integer;       {horizontal scrolling offset}
    efHPos             : Integer;       {current position in field (column)}
    efPicLen           : Word;          {length of picture mask}
    efPicture          : TPictureMask;  {picture mask}
    efRangeHi          : TRangeType;    {high range for the field}
    efRangeLo          : TRangeType;    {low range for the field}
    efSaveData         : Boolean;       {save data during create window}
    efSaveEdit         : PAnsiChar;     {saved copy of edit string}
    efSelStart         : Integer;       {start of highlighted selection}
    efSelEnd           : Integer;       {end of highlighted selection}
    efTopMargin        : Integer;       {margin above text}
    sefOptions         : TsefOptionSet; {secondary field options}

    {property methods}
    function GetAsBoolean : Boolean;
      {-return the field value as a Boolean value}
    function GetAsCents : LongInt;
      {-return the field value as a LongInt representing pennies}
    function GetAsExtended : Extended;
      {-return the field value as an Extended}
    function GetAsFloat : Double;
      {-return the field value as a Double}
    function GetAsInteger : Longint;
      {-return the field value as a LongInt}
    function GetAsDateTime : TDateTime;
      {-return the field value as a Delphi DateTime value}
    function GetAsStDate : TStDate;
      {-return the field value as a Orpheus Date value}
    function GetAsStTime : TStTime;
      {-return the field value as a Orpheus Time value}
    function GetAsString : string;
      {-return the field value as a String}
    {$IFDEF Win32}
    function GetAsVariant : Variant;
      {return the field value as a Variant}
    {$ENDIF}
    function GetCurrentPos : Integer;
      {-return position of the caret within the field}
    function GetDataSize : Word;
      {-return the size of the data for this field}
    function GetDisplayString : string;
      {-return the display string}
    function GetEditString : string;
      {-return the edit string}
    function GetEverModified : Boolean;
      {-return true if this field has ever been modified}
    function GetInsCaretType : TOvcCaret;
      {-return the current caret type}
    function GetInsertMode : Boolean;
      {-return the controller's insert mode state}
    function GetModified : Boolean;
      {-return true if this field is modified}
    function GetOvrCaretType : TOvcCaret;
      {-return the current caret type}
    function GetRangeHiStr : string;
      {-get the high field range as string value}
    function GetRangeLoStr : string;
      {-get the low field range as string value}
    function GetSelLength : Integer;
      {-return the length of the currently selected text}
    function GetSelStart : Integer;
      {-return the starting position of the selection, if any}
    function GetSelText : string;
      {-return the currently selected text}
    procedure SetAsBoolean(Value : Boolean);
      {-set the field value to a Boolean value}
    procedure SetAsCents(Value : LongInt);
      {-set the field value given a LongInt value representing pennies}
    procedure SetAsDateTime(Value : TDateTime);
      {-set the field value to a Delphi DateTime value}
    procedure SetAsExtended(Value : Extended);
      {-set the field value to an Extended value}
    procedure SetAsFloat(Value : Double);
      {-set the field value to a Double value}
    procedure SetAsInteger(Value : Longint);
      {-set the field value to a LongInt value}
    procedure SetAsStDate(Value : TStDate);
      {-set the field value to a Orpheus Date value}
    procedure SetAsStTime(Value : TStTime);
      {-set the field value to a Orpheus Time value}
    {$IFDEF Win32}
    procedure SetAsVariant(Value : Variant);
      {-set the field value to a Variant value}
    {$ENDIF}
    procedure SetAutoAdvanceChar(Value : Boolean);
      {-set the AutoAdvanceChar option}
    procedure SetAutoAdvanceLeftRight(Value : Boolean);
      {-set the AutoAdvanceLeftRight option}
    procedure SetAutoSelect(Value : Boolean);
      {-set the auto select setting on or off}
    procedure SetAutoSize(Value : Boolean);
      {-set the auto font adjust on or off}
    procedure SetBorderStyle(Value : TBorderStyle);
      {-set the type of border to use}
    procedure SetCaretToEnd(Value : Boolean);
      {-set the CaretToEnd option}
    procedure SetDecimalPlaces(Value : Byte);
      {-set the number of decimal places for the edit field}
    procedure SetEpoch(Value : Integer);
      {-set the epoch value}
    procedure SetEverModified(Value : Boolean);
      {-set the EverModified flag}
    procedure SetForceInsert(Value : Boolean);
      {-set the force insert option}
    procedure SetForceOvertype(Value : Boolean);
      {-set the force overtype option}
    procedure SetInputRequired(Value : Boolean);
      {-sets the InpurRequired option}
    procedure SetInsCaretType(const Value : TOvcCaret);
      {-set the type of caret to use}
    procedure SetInsertMode(Value : Boolean);
      {-changes the field's insert mode}
    procedure SetInsertPushes(Value : Boolean);
      {-set the InsertPushes option}
    procedure SetIntlSupport(Value : TOvcIntlSup);
      {-set the international support object this field will use}
    procedure SetMaxLength(Value : Word);
      {-set the maximum length of the edit field}
    procedure SetModified(Value : Boolean);
      {-set the modified flag}
    procedure SetOvrCaretType(const Value : TOvcCaret);
      {-set the type of caret to use}
    procedure SetPadChar(Value : AnsiChar);
      {-set the character used to pad the end of the edit string}
    procedure SetPasswordChar(Value : AnsiChar);
      {-set the character used to mask password entry}
    procedure SetPasswordMode(Value : Boolean);
      {-set use of password mode}
    procedure SetRangeLoStr(const Value : string);
      {-set the low field range from a string value}
    procedure SetRangeHiStr(const Value : string);
      {-set the high field range from a string value}
    procedure SetReadOnly(Value : Boolean);
      {-set the read only option}
    procedure SetRightJustify(Value : Boolean);
      {-set the right justify option}
    procedure SetSelLength(Value : Integer);
      {-set the extent of the selected text}
    procedure SetSelStart(Value : Integer);
      {-set the starting position of the selection}
    procedure SetSoftValidation(Value : Boolean);
      {-sets the SoftValidation option}
    procedure SetStripLiterals(Value : Boolean);
      {-set the strip literals option}
    procedure SetTextMargin(Value : Integer);
      {-set the text margin}
    procedure SetTrimBlanks(Value : Boolean);
      {-set the trim blanks option}
    procedure SetUninitialized(Value : Boolean);
      {-sets the Uninitialized option}
    procedure SetUserData(Value : TOvcUserData);
      {-sets user-defined mask data object}
    procedure SetZeroDisplay(Value : TZeroDisplay);
      {-set flag that determines if ZeroDisplayValue is hidden}
    procedure SetZeroDisplayValue(Value : Double);
      {-set value used by ZeroDisplay logic}

    {internal methods}
    procedure efCalcTopMargin;
      {-determines the top text margin}
    procedure efColorChanged(AColor : TObject);
      {-highlight or error color change-repaint}
    function efGetEpoch : Integer;
      {-return field's or controller's epoch value}
    procedure efInitializeDataSize;
      {-set the data size for this fiedl type}
    function  efIsSibling(HW : hWnd) : Boolean;
      {-is the window HW one of our siblings}
    procedure efMoveFocus(C : TWinControl);
      {-ask the parent form to move the focus to the specified control}
    procedure efPerformEdit(var Msg : TMessage; Cmd : Word);
      {-primitive routine to process the specified editing command}
    procedure efPerformPreEditNotify(C : TWinControl);
      {-pre-edit notification to parent form}
    procedure efPerformPostEditNotify(C : TWinControl);
      {-post-edit notification to parent form}
    procedure efReadRangeHi(Stream : TStream);
      {-called to read the high range from the stream}
    procedure efReadRangeLo(Stream : TStream);
      {-called to read the low range from the stream}
    function efTransferPrim(DataPtr : Pointer; TransferFlag : Word) : Word;
      {-primitive routine to reset for new data in field}
    procedure efWriteRangeHi(Stream : TStream);
      {-called to store the high range on the stream}
    procedure efWriteRangeLo(Stream : TStream);
      {-called to store the low range on the stream}

    {VCL control methods}
    procedure CMCtl3DChanged(var Msg : TMessage);                      {!!.01}
      message CM_CTL3DCHANGED;
    procedure CMDialogChar(var Msg : TCMDialogChar);
      message CM_DIALOGCHAR;
    procedure CMEnabledChanged(var Msg : TMessage);
      message CM_ENABLEDCHANGED;
    procedure CMFontChanged(var Msg : TMessage);
      message CM_FONTCHANGED;

    {private message response methods}
    procedure OMGetDataSize(var Msg : TMessage);
      message om_GetDataSize;
    procedure OMReportError(var Msg : TOMReportError);
      message om_ReportError;

    {windows message response methods}
    procedure WMCancelMode(var Msg : TWMCancelMode);
      message WM_CANCELMODE;
    procedure WMChar(var Msg : TWMChar);
      message WM_CHAR;
    procedure WMClear(var Msg : TWMClear);
      message WM_CLEAR;
    procedure WMCopy(var Msg : TWMCopy);
      message WM_COPY;
    procedure WMCut(var Msg : TWMCut);
      message WM_CUT;
    procedure WMEraseBkGnd(var Msg : TWMEraseBkGnd);
      message WM_ERASEBKGND;
    procedure WMGetDlgCode(var Msg : TWMGetDlgCode);
      message WM_GETDLGCODE;
    procedure WMKeyDown(var Msg : TWMKeyDown);
      message WM_KEYDOWN;
    procedure WMKillFocus(var Msg : TWMKillFocus);
      message WM_KILLFOCUS;
    procedure WMLButtonDblClk(var Msg : TWMLButtonDblClk);
      message WM_LBUTTONDBLCLK;
    procedure WMLButtonDown(var Msg : TWMLButtonDown);
      message WM_LBUTTONDOWN;
    procedure WMMouseActivate(var Msg : TWMMouseActivate);
      message WM_MOUSEACTIVATE;
    procedure WMMouseMove(var Msg : TWMMouseMove);
      message WM_MOUSEMOVE;
    procedure WMPaste(var Msg : TWMPaste);
      message WM_PASTE;
    procedure WMRButtonDown(var Msg : TWMRButtonDown);
      message WM_RBUTTONDOWN;
    procedure WMSetFocus(var Msg : TWMSetFocus);
      message WM_SETFOCUS;
    procedure WMSetFont(var Msg : TWMSetFont);
      message WM_SETFONT;
    procedure WMSetText(var Msg : TWMSetText);
      message WM_SETTEXT;
    procedure WMSize(var Msg : TWMSize);
      message WM_SIZE;
    procedure WMSysKeyDown(var Msg : TWMSysKeyDown);
      message WM_SYSKEYDOWN;

    {edit control message methods}
    procedure EMGetModify(var Msg : TMessage);
      message EM_GETMODIFY;
    procedure EMGetSel(var Msg : TMessage);
      message EM_GETSEL;
    procedure EMSetModify(var Msg : TMessage);
      message EM_SETMODIFY;
    procedure EMSetSel(var Msg : TMessage);
      message EM_SETSEL;

  protected
    {VCL methods}
    procedure CreateParams(var Params : TCreateParams);
      override;
    procedure CreateWnd;
      override;
    procedure DefineProperties(Filer : TFiler);
      override;
    procedure Paint;
      override;
    procedure SetBounds(ALeft, ATop, AWidth, AHeight : Integer);
      override;

    {dynamic event warppers}
    procedure DoOnChange;
      dynamic;
      {-perform notification of a change}
    procedure DoOnError(ErrorCode : Word; ErrorMsg : string);
      dynamic;
      {-perform notification of an error}
    procedure DoOnUserCommand(Command : Word);
      dynamic;
      {-perform notification of a user command}
    procedure DoOnUserValidation(var ErrorCode : Word);
      dynamic;
      {-perform call to user validation event handler}

    procedure efAdjustSize;
      dynamic;
      {-adjust the size of the control based on the current font}
    function efCanClose(DoValidation : Boolean) : Boolean;
      virtual;
      {-returns true if the field contents are valid}
    procedure efCaretToEnd;
      virtual;
      {-move the caret to the end of the field}
    procedure efCaretToStart;
      virtual;
      {-move the caret to the beginning of the field}
    procedure efChangeMask(Mask : PAnsiChar);
      dynamic;
      {-change the picture mask}
    function  efCharOK(PicChar : AnsiChar; var Ch : AnsiChar;
                     PrevCh : AnsiChar; Fix : Boolean) : Boolean;
      {-return True if Ch is in character set corresponding to PicChar}
    procedure efConditionalBeep;
      {-beep if pefBeepOnError option is active}
    procedure efCopyPrim;
      {-Primitive clipboard copy method}
    function efBinStr2Long(St : PAnsiChar; var L : LongInt) : Boolean;
      {-convert a binary string to a longint}
    function efCalcDataSize(St : PAnsiChar; MaxLen : Word) : Word;
      {-calculate data size of a string field with literal stripping option on}
    procedure efEdit(var Msg : TMessage; Cmd : Word);
      virtual; abstract;
      {-process the specified editing command}
    function  efEditBegin : Word;
      virtual;
      {-return offset of first editable position in field}
    function  efFieldIsEmpty : Boolean;
      virtual;
      {-return True if the field is empty}
    procedure efFieldModified;
      {-mark the field as modified; tell parent form it changed}
    procedure efFindCtrlChars(P : PAnsiChar; var ChCnt, CtCnt : Integer);
      {-find control caracters and return normal and control char counts}
    procedure efFixCase(PicChar : AnsiChar; var Ch : AnsiChar; PrevCh : AnsiChar);
      {-fix the case of Ch based on PicChar}
    function efGetDisplayString(Dest : PAnsiChar; Size : Word) : PAnsiChar;
      virtual;
      {-return the display string in Dest and a pointer as the result}
    function  efGetMousePos(MPos : Integer) : Integer;
      {-get the position of a mouse click}
    procedure efGetSampleDisplayData(T : PAnsiChar);
      dynamic;
      {-return sample data for the current field type}
    procedure efIncDecValue(Wrap : Boolean; Delta : Double);
      dynamic; abstract;
      {-increment field by Delta}
    function  efIsNumericType : Boolean;
      {-return True if field is of a numeric type}
    function  efIsReadOnly : Boolean;
      virtual;
      {-return True if field is read-only}
    procedure efLong2Str(P : PAnsiChar; L : LongInt);
      {-convert a longint to a string}
    procedure efMapControlChars(Dest, Src : PAnsiChar);
      {-copy from Src to Dest, mapping control characters to alph in process}
    procedure efMoveFocusToNextField;
      dynamic;
      {-give next field the focus}
    procedure efMoveFocusToPrevField;
      dynamic;
      {-give previous field the focus}
    function  efNthMaskChar(N : Word) : AnsiChar;
      {-return the N'th character in the picture mask. N is 0-based}
    function efOctStr2Long(St : PAnsiChar; var L : LongInt) : Boolean;
      {-convert an octal string to a longint}
    procedure efPaintPrim(DC : hDC; CR : TRect; Offset : Integer);
      {-primitive routine to draw the entry field control}
    procedure efPerformRepaint(Modified : Boolean);
      {-flag the field as modified and redraw it}
    function  efPositionCaret(Adjust : Boolean) : Boolean;
      {-position the editing caret}
    function efRangeToStRange(const Value : TRangeType) : string;
      {-returns the range as a string}
    function efStRangeToRange(const Value : string; var R : TRangeType) : Boolean;
      {-converts a string range to a RangeType}
    procedure efRemoveBadOptions;
      virtual;
      {-remove inappropriate options for this field and data type}
    procedure efResetCaret;
      virtual;
      {-move the caret to the beginning or end of the field, as appropriate}
    procedure efSaveEditString;
      {-save a copy of the edit string}
    procedure efSetDefaultRange(FT : Byte);
      {-set the default range for the given field type}
    procedure efSetInitialValue;
      {-set the initial value of the field}
    function efStr2Long(P : PAnsiChar; var L : LongInt) : Boolean;
      {-convert a string to a longint}
    function efTransfer(DataPtr : Pointer; TransferFlag : Word) : Word;
      virtual;
      {-transfer data to/from the entry fields}
    function efValidateField : Word;
      virtual; abstract;
      {-validate contents of field; result is error code or 0}

    {virtual property methods}
    procedure efSetCaretPos(Value : Integer);
      virtual;
      {-set position of the caret within the field}
    procedure SetAsString(const Value : string);
      virtual;
      {-sets the field value to a String Value}
    procedure SetName(const Value : TComponentName);
      override;
      {-catch when component name is changed}
  {.Z-}

  public
    constructor Create(AOwner : TComponent);
      override;
    destructor  Destroy;
      override;

    procedure ClearContents;
      {-clear the contents of the entry field}
    procedure ClearSelection;
      {-erase the highlighted text}
    procedure CopyToClipboard;
      {-copies the highlighted text to the clipboard}
    procedure CutToClipboard;
      dynamic;
      {-performs a CopyToClipboard then deletes the highlighted text from the field}
    procedure DecreaseValue(Wrap : Boolean; Delta : Double);
      {-decrease the value of the field by Delta, wrapping if enabled}
    procedure Deselect;
      {-unhighlight any highlighted text}
    function FieldIsEmpty : Boolean;
      {-return True if the field is completely empty}
    function GetStrippedEditString : string;
      dynamic;
      {-return edit string stripped of literals and semi-literals}
    function GetValue(var Data) : Word;
      {-returns the current field value in Data. Result is 0 or error code}
    procedure IncreaseValue(Wrap : Boolean; Delta : Double);
      {-increase the value of the field by Delta, wrapping if enabled}
    function IsValid : Boolean;
      {-returns true if the field is not marked as invalid}
    procedure MergeWithPicture(const S : string);
      dynamic;
      {-combines S with the picture mask and updates the edit string}
    procedure MoveCaret(Delta : Integer);
      {-moves the caret to the right or left Value positions}
    procedure MoveCaretToEnd;
      {-move the caret to the end of the field}
    procedure MoveCaretToStart;
      {-move the caret to the beginning of the field}
    procedure PasteFromClipboard;
      dynamic;
      {-places the text content of the clipboard into the field}
    procedure ProcessCommand(Cmd, CharCode : Word);
      {-process the specified command}
    procedure ResetCaret;
      {-move the caret to the beginning or end of the field, as appropriate}
    procedure Restore;
      dynamic;
      {-restore the previous contents of the field}
    procedure SelectAll;
      {-selects the current edit text}
    procedure SetInitialValue;
      {-resets the field value to its initial value}
    procedure SetRangeHi(const Value : TRangeType);
      {-set the high range for this field}
    procedure SetRangeLo(const Value : TRangeType);
      {-set the low range for this field}
    procedure SetSelection(Start, Stop : Word);
      {-mark offsets Start..Stop as selected}
    procedure SetValue(const Data);
      {-changes the field's value to the value in Data}
    function ValidateContents(ReportError : Boolean) : Word;
      {-performs field validation, returns error code, and conditionally reports error}
    function ValidateSelf : Boolean;
      {-performs field validation, returns true if no errors, and reports error}

    {public properties}
    property AsBoolean : Boolean
      read GetAsBoolean
      write SetAsBoolean;

    property AsCents : LongInt
      read GetAsCents
      write SetAsCents;

    property AsDateTime : TDateTime
      read GetAsDateTime
      write SetAsDateTime;

    property AsExtended : Extended
      read GetAsExtended
      write SetAsExtended;

    property AsFloat : Double
      read GetAsFloat
      write SetAsFloat;

    property AsInteger : Longint
      read GetAsInteger
      write SetAsInteger;

    property AsOvcDate : TOvcDate
      read GetAsStDate
      write SetAsStDate;

    property AsOvcTime : TOvcTime
      read GetAsStTime
      write SetAsStTime;

    property AsString : string
      read GetAsString
      write SetAsString;

    {$IFDEF Win32}
    property AsVariant : Variant
      read GetAsVariant
      write SetAsVariant;
    {$ENDIF}

    property AsStDate : TStDate
      read GetAsStDate
      write SetAsStDate;

    property AsStTime : TStTime
      read GetAsStTime
      write SetAsStTime;

    property Font;
    property Canvas;
    property Color;

    property CurrentPos : Integer
      read GetCurrentPos
      write efSetCaretPos;

    property DataSize : Word
      read GetDataSize;

    property DisplayString : string
      read GetDisplayString;

    property EditString : string
      read GetEditString;

    property Epoch : Integer
      read FEpoch
      write SetEpoch;

    property EverModified : Boolean
      read GetEverModified
      write SetEverModified;

    property InsertMode : Boolean
      read GetInsertMode
      write SetInsertMode;

    property IntlSupport : TOvcIntlSup
      read FIntlSup
      write SetIntlSupport;

    property LastError : Word
      read FLastError;

    property Modified : Boolean
      read GetModified
      write SetModified;

    property SelectionLength : Integer
      read GetSelLength
      write SetSelLength;

    property SelectionStart : Integer
      read GetSelStart
      write SetSelStart;

    property SelectedText : string
      read GetSelText;

    property Text : string
      read GetAsString
      write SetAsString;

    property UserData :  TOvcUserData
      read FUserData
      write SetUserData;

    {publishable properties}
    property AutoAdvanceChar : Boolean
      read FAutoAdvanceChar
      write SetAutoAdvanceChar
      default DefAutoAdvanceChar;

    property AutoAdvanceLeftRight : Boolean
      read FAutoAdvanceLR
      write SetAutoAdvanceLeftRight
      default DefAutoAdvanceLR;

    property AutoAdvanceUpDown : Boolean
      read FAutoAdvanceUD
      write FAutoAdvanceUD
      default DefAutoAdvanceUD;

    property AutoSelect : Boolean
      read FAutoSelect
      write SetAutoSelect
      default DefAutoSelect;

    property AutoSize : Boolean
      read FAutoSize
      write SetAutoSize
      default DefAutoSize;

    property BeepOnError : Boolean
      read FBeepOnError
      write FBeepOnError
      default DefBeepOnError;

    property BorderStyle : TBorderStyle
      read FBorderStyle
      write SetBorderStyle
      default DefBorderStyle;

    property CaretIns : TOvcCaret
      read GetInsCaretType
      write SetInsCaretType;

    property CaretOvr : TOvcCaret
      read GetOvrCaretType
      write SetOvrCaretType;

    property CaretToEnd : Boolean
      read FCaretToEnd
      write SetCaretToEnd
      default DefCaretToEnd;

    property ControlCharColor : TColor
      read FCtrlColor
      write FCtrlColor
      default DefCtrlColor;

    property DecimalPlaces : Byte
      read FDecimalPlaces
      write SetDecimalPlaces
      default DefDecimalPlaces;

    property ErrorColors : TOvcColors
      read FErrorColors
      write FErrorColors;

    property ForceInsert : Boolean
      read FForceInsert
      write SetForceInsert
      default DefForceInsert;

    property ForceOvertype : Boolean
      read FForceOvertype
      write SetForceOvertype
      default DefForceOvertype;

    property HighlightColors : TOvcColors
      read FHighlightColors
      write FHighlightColors;

    property InputRequired : Boolean
      read FInputRequired
      write SetInputRequired
      default DefInputRequired;

    property InsertPushes : Boolean
      read FInsertPushes
      write SetInsertPushes
      default DefInsertPushes;

    property MaxLength : Word
      read FMaxLength
      write SetMaxLength;

    property PadChar : AnsiChar
      read FPadChar
      write SetPadChar
      default DefPadChar;

    property PasswordChar : AnsiChar
      read FPasswordChar
      write SetPasswordChar
      default DefPasswordChar;

    property PasswordMode : Boolean
      read FPasswordMode
      write SetPasswordMode
      default DefPasswordMode;

    property RangeHi : string
      read GetRangeHiStr
      write SetRangeHiStr
      stored False;

    property RangeLo : string
      read GetRangeLoStr
      write SetRangeLoStr
      stored False;

    property ReadOnly : Boolean
      read FReadOnly
      write SetReadOnly
      default DefReadOnly;

    property RightJustify : Boolean
      read FRightJustify
      write SetRightJustify
      default DefRightJustify;

    property SoftValidation : Boolean
      read FSoftValidation
      write SetSoftValidation
      default DefSoftValidation;

    property StripLiterals : Boolean
      read FStripLiterals
      write SetStripLiterals
      default DefStripLiterals;

    property TextMargin : Integer
      read FTextMargin
      write SetTextMargin
      default DefTextMargin;

    property TrimBlanks : Boolean
      read FTrimBlanks
      write SetTrimBlanks
      default DefTrimBlanks;

    property Uninitialized : Boolean
      read FUninitialized
      write SetUninitialized
      default DefUninitialized;

    property ZeroDisplay : TZeroDisplay
      read FZeroDisplay
      write SetZeroDisplay
      default DefZeroDisplay;

    property ZeroDisplayValue : Double
      read FZeroDisplayValue
      write SetZeroDisplayValue;

    {events}
    property OnChange : TNotifyEvent
      read FOnChange
      write FOnChange;

    property OnError : TValidationErrorEvent
      read FOnError
      write FOnError;

    property OnUserCommand : TUserCommandEvent
      read FOnUserCommand
      write FOnUserCommand;

    property OnUserValidation : TUserValidationEvent
      read FOnUserValidation
      write FOnUserValidation;
  published
  end;


implementation
