home *** CD-ROM | disk | FTP | other *** search
/ Chip 2001 October / Chip_2001-10_cd1.bin / zkuste / delphi / kompon / d123456 / CHEMPLOT.ZIP / Misc / Vedit.pas < prev    next >
Pascal/Delphi Source File  |  2001-05-02  |  20KB  |  668 lines

  1. unit Vedit;
  2.  
  3. {-----------------------------------------------------------------------------
  4. The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
  5.  
  6. http://www.mozilla.org/MPL/MPL-1.1.html
  7.  
  8. Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for the specific language governing rights and limitations under the License.
  9.  
  10. The Original Code is: VEdit.pas, released 12 September 2000.
  11.  
  12. The Initial Developer of the Original Code is Mat Ballard.
  13. Portions created by Mat Ballard are Copyright (C) 1999 Mat Ballard.
  14. Portions created by Microsoft are Copyright (C) 1998, 1999 Microsoft Corp.
  15. All Rights Reserved.
  16.  
  17. Contributor(s): Mat Ballard                 e-mail: mat.ballard@chemware.hypermart.net.
  18.  
  19. Last Modified: 10/01/2001
  20. Current Version: 2.00
  21.  
  22. You may retrieve the latest version of this file from:
  23.  
  24.         http://Chemware.hypermart.net/
  25.  
  26. This work was created with the Project JEDI VCL guidelines:
  27.  
  28.         http://www.delphi-jedi.org/Jedi:VCLVCL
  29.  
  30. in mind. 
  31.  
  32.  
  33. Purpose:
  34. Limit user input to various types and ranges of number.
  35.  
  36. Note: this component differs in some important but subtle ways to TNEdit:
  37.         1. the primary value is numerical, stored as Extended, rather than text;
  38.         2. the value is set after each keypress
  39.         3. there is an additional OnAssignment event
  40.         4. TFloatFormat is used directly
  41.         5. KeyOK is now public
  42.  
  43. Known Issues:
  44. -----------------------------------------------------------------------------}
  45.  
  46. {$I Misc.inc}
  47.  
  48. interface
  49.  
  50. uses
  51.   Misc,
  52.   Classes, SysUtils,
  53. {$IFDEF WINDOWS}
  54.   WinTypes, WinProcs,
  55.   Forms, StdCtrls, Graphics, Controls
  56. {$ENDIF}
  57. {$IFDEF WIN32}
  58.   Windows,
  59.   Forms, StdCtrls
  60. {$ENDIF}
  61. {$IFDEF LINUX}
  62.   Untranslated,
  63.   QForms, QStdCtrls
  64. {$ENDIF}
  65.   ;
  66.  
  67. type
  68.   TDisplayType = (dtInteger, dtBinary, dtHex, dtReal);
  69.  
  70.   {TFloatFormat = (ffGeneral, ffExponent, ffFixed, ffNumber, ffCurrency)}
  71.  
  72.   TVEdit = class(TCustomEdit)
  73.   private
  74.     { Private declarations }
  75.     FDisplayType: TDisplayType;
  76.     FDecimals: Byte;
  77.     FFloatFormat: TFloatFormat;
  78.     FMin: Extended;
  79.     FMax: Extended;
  80.     FValue: Extended;
  81.  
  82.     FOnAssignment: TNotifyEvent;
  83.     FOnDisplayTypeChange: TNotifyEvent;
  84.  
  85.     function GetBinary: String;
  86.     function GetHexadecimal: String;
  87. {$IFDEF DELPHI4_UP}
  88.     function GetInteger: Int64;
  89. {$ELSE}
  90.     function GetInteger: Integer;
  91. {$ENDIF}
  92. {$IFDEF DELPHI2_UP}
  93.     function GetCurrency: Currency;
  94. {$ENDIF}
  95.  
  96.     procedure SetDecimals(Value: Byte);
  97.     procedure SetFloatFormat(Value: TFloatFormat);
  98.     procedure SetDisplayType(Value: TDisplayType);
  99.  
  100.     procedure SetBinary(Value: String);
  101.     procedure SetHexadecimal(Value: String);
  102. {$IFDEF DELPHI4_UP}
  103.     procedure SetInteger(Value: Int64);
  104. {$ELSE}
  105.     procedure SetInteger(Value: Integer);
  106. {$ENDIF}
  107.     procedure SetReal(Value: Extended);
  108. {$IFDEF DELPHI2_UP}
  109.     procedure SetCurrency(Value: Currency);
  110. {$ENDIF}
  111.  
  112.   protected
  113.     {Procedure KeyDown(var Key: Word; Shift: TShiftState); override;}
  114.     Procedure KeyPress(var Key: Char); override;
  115.     Procedure KeyUp(var Key: Word; Shift: TShiftState); override;
  116.     procedure DoAssignment; virtual;
  117.     procedure DoDisplayTypeChange; virtual;
  118.     procedure DoExit; override;
  119.     procedure DoText; virtual;
  120.     procedure DoValue; virtual;
  121.   public
  122.     { Public declarations }
  123.     Constructor Create(AOwner:TComponent);override;
  124.     function KeyOK(Key: Char): Boolean; virtual;
  125.   published
  126.     { Published declarations }
  127.     Property AsBinary: String read GetBinary write SetBinary stored FALSE;
  128.     Property AsHex: String read GetHexadecimal write SetHexadecimal stored FALSE;
  129.     Property AsReal: Extended read FValue write SetReal stored FALSE;
  130.     Property AsInteger: {$IFDEF DELPHI4_UP}Int64{$ELSE}Integer{$ENDIF}
  131.       read GetInteger
  132.       write SetInteger stored FALSE;
  133. {$IFDEF DELPHI2_UP}
  134.     Property AsCurrency: Currency read GetCurrency write SetCurrency stored FALSE;
  135. {$ENDIF}
  136.     Property Decimals: Byte read FDecimals write SetDecimals;
  137.     Property FloatFormat: TFloatFormat read FFloatFormat write SetFloatFormat;
  138.     Property Min: Extended read FMin write FMin;
  139.     Property Max: Extended read FMax write FMax;
  140.     Property DisplayType: TDisplayType read FDisplayType write SetDisplayType;
  141.  
  142.     Property OnAssignment: TNotifyEvent read FOnAssignment write FOnAssignment;
  143.     Property OnDisplayTypeChange: TNotifyEvent read FOnDisplayTypeChange write FOnDisplayTypeChange;
  144.  
  145. {The Custom... properties:}
  146.     property AutoSelect;
  147.     property AutoSize;
  148.     property BorderStyle;
  149.     property CharCase;
  150.     property Color;
  151. {$IFDEF MSWINDOWS}
  152.     property Ctl3D;
  153.     property DragCursor;
  154. {$ENDIF}
  155.     property Enabled;
  156.     property Font;
  157.     property HideSelection;
  158.     property MaxLength;
  159. {$IFDEF MSWINDOWS}
  160.     property OEMConvert;
  161. {$ENDIF}
  162.     property ParentColor;
  163. {$IFDEF MSWINDOWS}
  164.     property ParentCtl3D;
  165. {$ENDIF}
  166.     property ParentFont;
  167.     property ParentShowHint;
  168. {$IFDEF MSWINDOWS}
  169.     property PasswordChar;
  170. {$ENDIF}
  171.     property ReadOnly;
  172.     property ShowHint;
  173.     property TabOrder;
  174.     property TabStop;
  175.     property Text;
  176.     property Visible;
  177.     property OnChange;
  178.     property OnClick;
  179.     property OnDblClick;
  180.     property OnDragDrop;
  181.     property OnDragOver;
  182.     property OnEndDrag;
  183.     property OnEnter;
  184.     property OnExit;
  185.     property OnKeyDown;
  186.     property OnKeyPress;
  187.     property OnKeyUp;
  188.     property OnMouseDown;
  189.     property OnMouseMove;
  190.     property OnMouseUp;
  191. {$IFDEF DELPHI2_UP}
  192. {$ENDIF}
  193. {$IFDEF DELPHI3_UP}
  194. {$ENDIF}
  195. {$IFDEF DELPHI4_UP}
  196.     property Anchors;
  197. {$IFDEF MSWINDOWS}
  198.     property BiDiMode;
  199. {$ENDIF}
  200.     property Constraints;
  201. {$IFDEF MSWINDOWS}
  202.     property DragKind;
  203. {$ENDIF}
  204.     property DragMode;
  205. {$IFDEF MSWINDOWS}
  206.     property ImeMode;
  207.     property ImeName;
  208.     property ParentBiDiMode;
  209. {$ENDIF}
  210.     property PopupMenu;
  211. {$IFDEF MSWINDOWS}
  212.     property OnEndDock;
  213.     property OnStartDock;
  214. {$ENDIF}
  215.     property OnStartDrag;
  216. {$ENDIF}
  217. {$IFDEF DELPHI5_UP}
  218. {$ENDIF}
  219.   end;
  220.  
  221. const
  222.   TVEdit_VERSION = 100;
  223.  
  224. implementation
  225.  
  226. {------------------------------------------------------------------------------
  227.     Procedure: TVEdit.Create
  228.   Description: standard constructor
  229.        Author: Mat Ballard
  230.  Date created: 04/25/2000
  231. Date modified: 04/25/2000 by Mat Ballard
  232.       Purpose: sets the Text and DataType
  233.  Known Issues:
  234.  ------------------------------------------------------------------------------}
  235. constructor TVEdit.Create(AOwner:TComponent);
  236. begin
  237.   inherited Create(AOwner);
  238.   FDecimals := 0;
  239.   FValue := 0;
  240.   DoText;
  241. end;
  242.  
  243. {------------------------------------------------------------------------------
  244.     Procedure: TVEdit.KeyDown
  245.   Description: standard KeyDown event handler
  246.        Author: Mat Ballard
  247.  Date created: 04/25/2000
  248. Date modified: 04/25/2000 by Mat Ballard
  249.       Purpose: examines Key to see if valid
  250.  Known Issues:
  251.  ------------------------------------------------------------------------------}
  252. {Procedure TVEdit.KeyDown(var Key: Word; Shift: TShiftState);
  253. var
  254.   KeyOK: Boolean;
  255.   ChrKey: Char;
  256. begin
  257.   KeyOK := FALSE;
  258.   ChrKey := Chr(Key);
  259.  
  260.   if ((Key = VK_TAB) or
  261.       (Key = VK_RETURN)) then
  262. {done or losing focus:
  263.     KeyOK := TRUE
  264.   else if ((Key = VK_BACK) or
  265.            (Key = VK_CLEAR) or
  266.            (Key = VK_RIGHT) or
  267.            (Key = VK_DELETE) or
  268.            (Key = VK_LEFT) or
  269.            (Key = VK_END) or
  270.            (Key = VK_HOME)) then
  271.     KeyOK := TRUE
  272.   else if (ChrKey in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']) then
  273. {is a basic numeral:
  274.     KeyOK := TRUE
  275.   else if (ChrKey = '-') then
  276.   begin
  277.     if ((Length(Text) = 0) and
  278.         (FMin < 0)) then
  279. {is a negative number:
  280.       KeyOK := TRUE
  281.     else if (UpperCase(Text[Length(Text)]) = 'E') then
  282.       KeyOK := TRUE;
  283.   end
  284.   else
  285.   begin
  286.     Case FDisplayType of
  287.       dtBinary:
  288.         if (ChrKey in ['2', '3', '4', '5', '6', '7', '8', '9']) then
  289.           KeyOK := FALSE;
  290.       dtHex:
  291.         if (ChrKey in ['a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F']) then
  292.           KeyOK := TRUE;
  293.       dtReal:
  294.         if ((ChrKey in ['.', 'e', 'E']) and
  295.             (Pos(ChrKey, Text) = 0))then
  296.           KeyOK := TRUE;
  297.     end;
  298.   end;
  299.  
  300.   if (not KeyOK) then
  301.     Key := 0;
  302. {call the TEdit parent function last:
  303.   inherited KeyDown(Key, Shift);
  304. end;
  305. }
  306.  
  307. {------------------------------------------------------------------------------
  308.     Procedure: TVEdit.KeyPress
  309.   Description: standard KeyPress event handler
  310.        Author: Mat Ballard
  311.  Date created: 01/05/2001
  312. Date modified: 01/05/2001 by Mat Ballard
  313.       Purpose: examines Key to see if valid
  314.  Known Issues:
  315.  ------------------------------------------------------------------------------}
  316. Procedure TVEdit.KeyPress(var Key: Char);
  317. begin
  318.   if (not KeyOK(Key)) then
  319.     Key := Chr(0);
  320. {call the TEdit parent function last:}
  321.   inherited KeyPress(Key);
  322. end;
  323.  
  324. {------------------------------------------------------------------------------
  325.      Function: TVEdit.KeyOK
  326.   Description: Is this Key OK ?
  327.        Author: Mat Ballard
  328.  Date created: 01/05/2001
  329. Date modified: 01/05/2001 by Mat Ballard
  330.       Purpose: examines Key to see if valid
  331.  Known Issues:
  332.  ------------------------------------------------------------------------------}
  333. Function TVEdit.KeyOK(Key: Char): Boolean;
  334. begin
  335.   KeyOK := FALSE;
  336.  
  337.   if (Key in [Chr(VK_BACK), '0', '1', '2', '3', '4', '5', '6', '7', '8', '9']) then
  338. {is a basic numeral:}
  339.     KeyOK := TRUE
  340.   else if (Key = '-') then
  341.   begin
  342.     if ((Length(Text) = 0) and
  343.         (FMin < 0)) then
  344. {is a negative number:}
  345.       KeyOK := TRUE
  346.     else if (UpperCase(Text[Length(Text)]) = 'E') then
  347.       KeyOK := TRUE;
  348.   end
  349.   else
  350.   begin
  351.     Case FDisplayType of
  352.       dtBinary:
  353.         if (Key in ['2', '3', '4', '5', '6', '7', '8', '9']) then
  354.           KeyOK := FALSE;
  355.       dtHex:
  356.         if (Key in ['a', 'b', 'c', 'd', 'e', 'f', 'A', 'B', 'C', 'D', 'E', 'F']) then
  357.           KeyOK := TRUE;
  358.       dtReal:
  359.         if ((Key in ['.', 'e', 'E']) and
  360.             (Pos(Key, Text) = 0))then
  361.           KeyOK := TRUE;
  362.     end;
  363.   end;
  364. end;
  365.  
  366. Procedure TVEdit.KeyUp(var Key: Word; Shift: TShiftState);
  367. begin
  368.   if (Length(Text) > 0) then
  369.   begin
  370.     if ((Text = '-') or (Text = '.') or (Text = '-.')) then
  371.       FValue := 0
  372.     else
  373.     begin
  374.       try
  375.         Case FDisplayType of
  376.           dtInteger, dtHex: FValue := StrToInt(Text);
  377.           dtBinary: FValue := BinToInt(Text);
  378.           dtReal: FValue := StrToFloat(Text);
  379.         end;
  380.       finally
  381.       end;
  382.     end;
  383.   end
  384.   else
  385.     FValue := 0;  
  386. end;
  387.  
  388. {------------------------------------------------------------------------------
  389.     Procedure: TVEdit.SetFloatFormat
  390.   Description: standard property Set procedure
  391.        Author: Mat Ballard
  392.  Date created: 01/04/2001
  393. Date modified: 01/04/2000 by Mat Ballard
  394.       Purpose: sets the Format Property
  395.  Known Issues:
  396.  ------------------------------------------------------------------------------}
  397. procedure TVEdit.SetDecimals(Value: Byte);
  398. begin
  399.   FDecimals := Value;
  400.   DoText;
  401. end;
  402.  
  403. {------------------------------------------------------------------------------
  404.     Procedure: TVEdit.SetFloatFormat
  405.   Description: standard property Set procedure
  406.        Author: Mat Ballard
  407.  Date created: 01/04/2001
  408. Date modified: 01/04/2000 by Mat Ballard
  409.       Purpose: sets the Format Property
  410.  Known Issues:
  411.  ------------------------------------------------------------------------------}
  412. procedure TVEdit.SetFloatFormat(Value: TFloatFormat);
  413. begin
  414.   FFloatFormat := Value;
  415.   DoText;
  416. end;
  417.  
  418. {------------------------------------------------------------------------------
  419.     Procedure: TVEdit.SetDisplayType
  420.   Description: standard property Set procedure
  421.        Author: Mat Ballard
  422.  Date created: 04/25/2000
  423. Date modified: 01/04/2001 by Mat Ballard
  424.       Purpose: sets the DisplayType Property
  425.  Known Issues:
  426.  ------------------------------------------------------------------------------}
  427. procedure TVEdit.SetDisplayType(Value: TDisplayType);
  428. begin
  429.   if (Value = FDisplayType) then exit;
  430.  
  431.   FDisplayType := Value;
  432.   DoText;
  433. end;
  434.  
  435. procedure TVEdit.DoAssignment;
  436. begin
  437.   if Assigned(FOnAssignment) then
  438.     OnAssignment(Self);
  439. end;
  440.  
  441. procedure TVEdit.DoDisplayTypeChange;
  442. begin
  443.   if Assigned(FOnDisplayTypeChange) then
  444.     OnDisplayTypeChange(Self);
  445. end;
  446.  
  447. {------------------------------------------------------------------------------
  448.     Procedure: TVEdit.DoExit
  449.   Description: standard DoExit event handler
  450.        Author: Mat Ballard
  451.  Date created: 04/25/2000
  452. Date modified: 04/25/2000 by Mat Ballard
  453.       Purpose: examines the validity of the Text
  454.  Known Issues:
  455.  ------------------------------------------------------------------------------}
  456. procedure TVEdit.DoExit;
  457. begin
  458.   inherited DoExit;
  459. end;
  460.  
  461. procedure TVEdit.DoText;
  462. var
  463.   Digits,
  464.   Precision: Integer;  {FDecimals}
  465. begin
  466.   Precision := 18; {Extended}
  467.   Digits := 0; {often min number of exponent digits}
  468.  
  469.   case FDisplayType of
  470.     dtInteger: Text := IntToStr(Round(FValue));
  471.     dtBinary: Text := IntToBin(Round(FValue));
  472.     dtHex: Text := IntToHex(Round(FValue), 0);
  473.     dtReal:
  474.       begin
  475.         case FFloatFormat of
  476.           {ffGeneral: ;}
  477.           ffExponent:
  478.               Precision := FDecimals+1;
  479.           ffFixed:
  480.               Digits := FDecimals;
  481.           ffNumber:
  482.               Digits := FDecimals;
  483.           ffCurrency:
  484.               Digits := FDecimals;
  485.         end;
  486.         Text := FloatToStrF(FValue, FFloatFormat, Precision, Digits);
  487.       end;
  488.   end;
  489.  
  490. end;
  491.  
  492. procedure TVEdit.DoValue;
  493. begin
  494.   try
  495.     Case FDisplayType of
  496.       dtInteger: ;
  497.       dtBinary: ;
  498.       dtHex: ;
  499.       dtReal: ;
  500.     end;
  501.   finally
  502.   end;
  503. end;
  504.  
  505. {------------------------------------------------------------------------------
  506.      Function: TVEdit.GetBinary
  507.   Description: standard property Get function
  508.        Author: Mat Ballard
  509.  Date created: 01/04/2001
  510. Date modified: 01/04/2001 by Mat Ballard
  511.       Purpose: gets the value of the Value Property as a Binary string
  512.  Return Value: String
  513.  Known Issues:
  514.  ------------------------------------------------------------------------------}
  515. function TVEdit.GetBinary: String;
  516. begin
  517.   GetBinary := IntToBin(Round(FValue));
  518. end;
  519.  
  520. {------------------------------------------------------------------------------
  521.      Function: TVEdit.GetHexadecimal
  522.   Description: standard property Get function
  523.        Author: Mat Ballard
  524.  Date created: 01/04/2001
  525. Date modified: 01/04/2001 by Mat Ballard
  526.       Purpose: gets the value of the Value Property as an Hexadecimal string
  527.  Return Value: String
  528.  Known Issues:
  529.  ------------------------------------------------------------------------------}
  530. function TVEdit.GetHexadecimal: String;
  531. begin
  532.   GetHexadecimal := IntToHex(Round(FValue), 0);
  533. end;
  534.  
  535. {------------------------------------------------------------------------------
  536.      Function: TVEdit.GetInteger
  537.   Description: standard property Get function
  538.        Author: Mat Ballard
  539.  Date created: 04/25/2000
  540. Date modified: 04/25/2000 by Mat Ballard
  541.       Purpose: gets the value of the Text Property as an Integer
  542.  Return Value: IntEGER
  543.  Known Issues:
  544.  ------------------------------------------------------------------------------}
  545. {$IFDEF DELPHI4_UP}
  546. function TVEdit.GetInteger: Int64;
  547. {$ELSE}
  548. function TVEdit.GetInteger: Integer;
  549. {$ENDIF}
  550. begin
  551.   GetInteger := Round(FValue);
  552. end;
  553.  
  554. {------------------------------------------------------------------------------
  555.      Function: TVEdit.GetCurrency
  556.   Description: standard property Get function
  557.        Author: Mat Ballard
  558.  Date created: 04/25/2000
  559. Date modified: 04/25/2000 by Mat Ballard
  560.       Purpose: gets the value of the Text Property as Currency
  561.  Return Value: Currency
  562.  Known Issues:
  563.  ------------------------------------------------------------------------------}
  564. {$IFDEF DELPHI2_UP}
  565. function TVEdit.GetCurrency: Currency;
  566. begin
  567.   GetCurrency := FValue;
  568. end;
  569. {$ENDIF}
  570.  
  571. {------------------------------------------------------------------------------
  572.     Procedure: TVEdit.SetBinary
  573.   Description: standard property Set procedure
  574.        Author: Mat Ballard
  575.  Date created: 01/04/2001 
  576. Date modified: 01/04/2001 by Mat Ballard
  577.       Purpose: sets the Value as binary
  578.  Known Issues:
  579.  ------------------------------------------------------------------------------}
  580. procedure TVEdit.SetBinary(Value: String);
  581. begin
  582.   DisplayType := dtBinary;
  583.   FValue := BinToInt(Value);
  584.   DoText;
  585.   DoAssignment;
  586. end;
  587.  
  588. {------------------------------------------------------------------------------
  589.     Procedure: TVEdit.SetHexadecimal
  590.   Description: standard property Set procedure
  591.        Author: Mat Ballard
  592.  Date created: 01/04/2001
  593. Date modified: 01/04/2001 by Mat Ballard
  594.       Purpose: sets the Value as hex
  595.  Known Issues:
  596.  ------------------------------------------------------------------------------}
  597. procedure TVEdit.SetHexadecimal(Value: String);
  598. begin
  599.   DisplayType := dtHex;
  600.   FValue := StrToInt('$' + Value);
  601.   DoText;
  602.   DoAssignment;
  603. end;
  604.  
  605. {------------------------------------------------------------------------------
  606.     Procedure: TVEdit.SetInteger
  607.   Description: standard property Set procedure
  608.        Author: Mat Ballard
  609.  Date created: 04/25/2000
  610. Date modified: 01/04/2001 by Mat Ballard
  611.       Purpose: sets the Text Property Displayally
  612.  Known Issues:
  613.  ------------------------------------------------------------------------------}
  614. {$IFDEF DELPHI4_UP}
  615. procedure TVEdit.SetInteger(Value: Int64);
  616. {$ELSE}
  617. procedure TVEdit.SetInteger(Value: Integer);
  618. {$ENDIF}
  619. begin
  620.   if (FDisplayType = dtReal) then
  621.     DisplayType := dtInteger;
  622.   FValue := Value;
  623.   DoText;
  624.   DoAssignment;
  625. end;
  626.  
  627. {------------------------------------------------------------------------------
  628.     Procedure: TVEdit.SetReal
  629.   Description: standard property Set procedure
  630.        Author: Mat Ballard
  631.  Date created: 04/25/2000
  632. Date modified: 01/04/2001 by Mat Ballard
  633.       Purpose: sets the Text Property Displayally
  634.  Known Issues:
  635.  ------------------------------------------------------------------------------}
  636. procedure TVEdit.SetReal(Value: Extended);
  637. begin
  638.   DisplayType := dtReal;
  639.   FValue := Value;
  640.   if (FFloatFormat = ffCurrency) then
  641.     FFloatFormat := ffGeneral;
  642.   DoText;
  643.   DoAssignment;
  644. end;
  645.  
  646. {------------------------------------------------------------------------------
  647.     Procedure: TVEdit.SetCurrency
  648.   Description: standard property Set procedure
  649.        Author: Mat Ballard
  650.  Date created: 04/25/2000
  651. Date modified: 04/25/2000 by Mat Ballard
  652.       Purpose: sets the Text Property Displayally
  653.  Known Issues:
  654.  ------------------------------------------------------------------------------}
  655. {$IFDEF DELPHI2_UP}
  656. procedure TVEdit.SetCurrency(Value: Currency);
  657. begin
  658.   DisplayType := dtReal;
  659.   FloatFormat := ffCurrency;
  660.   FValue := Value;
  661.   DoText;
  662.   DoAssignment;
  663. end;
  664. {$ENDIF}
  665.  
  666.  
  667. end.
  668.