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

  1. unit Nedit;
  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: NEdit.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: 05/25/2000
  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. Known Issues:
  37.  0         32    [space]      64    @     96    `
  38.  1         33    !     65    A     97    a
  39.  2         34    "     66    B     98    b
  40.  3         35    #     67    C     99    c
  41.  4         36    $     68    D     100    d
  42.  5         37    %     69    E     101    e
  43.  6         38    &     70    F     102    f
  44.  7         39    '     71    G     103    g
  45.  8    * *     40    (     72    H     104    h
  46.  9    * *     41    )     73    I     105    i
  47.  10    * *     42    *     74    J     106    j
  48.  11         43    +     75    K     107    k
  49.  12         44    ,     76    L     108    l
  50.  13    * *     45    -     77    M     109    m
  51.  14         46    .     78    N     110    n
  52.  15         47    /     79    O     111    o
  53.  16         48    0     80    P     112    p
  54.  17         49    1     81    Q     113    q
  55.  18         50    2     82    R     114    r
  56.  19         51    3     83    S     115    s
  57.  20         52    4     84    T     116    t
  58.  21         53    5     85    U     117    u
  59.  22         54    6     86    V     118    v
  60.  23         55    7     87    W     119    w
  61.  24         56    8     88    X     120    x
  62.  25         57    9     89    Y     121    y
  63.  26         58    :     90    Z     122    z
  64.  27         59    ;     91    [     123    {
  65.  28         60    <     92    \     124    |
  66.  29         61    =     93    ]     125    curly brackets
  67.  30         62    >     94    ^     126    ~
  68.  31         63    ?     95    _     127
  69. -----------------------------------------------------------------------------}
  70.  
  71. {$I Misc.inc}
  72.  
  73. interface
  74.  
  75. uses
  76.   Classes, SysUtils,
  77. {$IFDEF NO_MATH}NoMath,{$ELSE}Math,{$ENDIF}
  78. {$IFDEF WINDOWS}
  79.   WinTypes, WinProcs,
  80.   Forms, StdCtrls, Graphics, Controls,
  81. {$ENDIF}
  82. {$IFDEF WIN32}
  83.   Windows,
  84.   Forms, StdCtrls,
  85. {$ENDIF}
  86. {$IFDEF LINUX}
  87.   Untranslated,
  88.   QForms, QStdCtrls,
  89. {$ENDIF}
  90.   Misc;
  91.  
  92. type
  93.   TNumericType = (ntInteger, ntBinary, ntHex, ntFixed, ntCurrency, ntScientific);
  94.  
  95.   TDataType = (dtInteger, dtCardinal,
  96.     dtShortint, dtSmallint, dtLongint,
  97. {$IFDEF DELPHI2_UP}
  98.     dtInt64,
  99. {$ENDIF}
  100.     dtByte, dtWord,
  101. {$IFDEF DELPHI2_UP}
  102.     dtLongword,
  103. {$ENDIF}
  104.     dtReal, dtReal48, dtSingle, dtDouble, dtExtended, dtComp
  105. {$IFDEF DELPHI2_UP}
  106.     ,dtCurrency
  107. {$ENDIF}
  108.     );
  109.  
  110.   TNEdit = class(TCustomEdit)
  111.   private
  112.     { Private declarations }
  113.     FDataType: TDataType;
  114.     FMin: Extended;
  115.     FMax: Extended;
  116.     FNumericType: TNumericType;
  117.  
  118.     function GetReal: Extended;
  119. {$IFDEF DELPHI4_UP}
  120.     function GetInt64: Int64;
  121. {$ENDIF}
  122.     function GetInteger: Integer;
  123. {$IFDEF DELPHI2_UP}
  124.     function GetCurrency: Currency;
  125. {$ENDIF}
  126.  
  127.     procedure SetDataType(Value: TDataType);
  128.     procedure SetNumericType(Value: TNumericType);
  129.     procedure SetReal(Value: Extended);
  130. {$IFDEF DELPHI4_UP}
  131.     procedure SetInt64(Value: Int64);
  132. {$ENDIF}
  133.     procedure SetInteger(Value: Integer);
  134. {$IFDEF DELPHI2_UP}
  135.     procedure SetCurrency(Value: Currency);
  136. {$ENDIF}
  137.  
  138.   protected
  139.     Procedure KeyDown(var Key: Word; Shift: TShiftState); override;
  140.     procedure DoExit; override;
  141.   public
  142.     { Public declarations }
  143.     Constructor Create(AOwner:TComponent);override;
  144.     function IsValid: Boolean;
  145.   published
  146.     { Published declarations }
  147.     Property AsReal: Extended read GetReal write SetReal stored FALSE;
  148. {$IFDEF DELPHI4_UP}
  149.     Property AsInt64: Int64 read GetInt64 write SetInt64 stored FALSE;
  150. {$ENDIF}
  151.     Property AsInteger: Integer read GetInteger write SetInteger stored FALSE;
  152. {$IFDEF DELPHI2_UP}
  153.     Property AsCurrency: Currency read GetCurrency write SetCurrency stored FALSE;
  154. {$ENDIF}
  155.     Property DataType: TDataType read FDataType write SetDataType;
  156.     Property Min: Extended read FMin write FMin;
  157.     Property Max: Extended read FMax write FMax;
  158.     Property NumericType: TNumericType read FNumericType write SetNumericType;
  159.  
  160. {The Custom... properties:}
  161.     property AutoSelect;
  162.     property AutoSize;
  163.     property BorderStyle;
  164.     property CharCase;
  165.     property Color;
  166. {$IFDEF MSWINDOWS}
  167.     property Ctl3D;
  168.     property DragCursor;
  169. {$ENDIF}
  170.     property Enabled;
  171.     property Font;
  172.     property HideSelection;
  173.     property MaxLength;
  174. {$IFDEF MSWINDOWS}
  175.     property OEMConvert;
  176. {$ENDIF}
  177.     property ParentColor;
  178. {$IFDEF MSWINDOWS}
  179.     property ParentCtl3D;
  180. {$ENDIF}
  181.     property ParentFont;
  182.     property ParentShowHint;
  183. {$IFDEF MSWINDOWS}
  184.     property PasswordChar;
  185. {$ENDIF}
  186.     property ReadOnly;
  187.     property ShowHint;
  188.     property TabOrder;
  189.     property TabStop;
  190.     property Text;
  191.     property Visible;
  192.     property OnChange;
  193.     property OnClick;
  194.     property OnDblClick;
  195.     property OnDragDrop;
  196.     property OnDragOver;
  197.     property OnEndDrag;
  198.     property OnEnter;
  199.     property OnExit;
  200.     property OnKeyDown;
  201.     property OnKeyPress;
  202.     property OnKeyUp;
  203.     property OnMouseDown;
  204.     property OnMouseMove;
  205.     property OnMouseUp;
  206. {$IFDEF DELPHI2_UP}
  207. {$ENDIF}
  208. {$IFDEF DELPHI3_UP}
  209. {$ENDIF}
  210. {$IFDEF DELPHI4_UP}
  211.     property Anchors;
  212. {$IFDEF MSWINDOWS}
  213.     property BiDiMode;
  214. {$ENDIF}
  215.     property Constraints;
  216. {$IFDEF MSWINDOWS}
  217.     property DragKind;
  218. {$ENDIF}
  219.     property DragMode;
  220. {$IFDEF MSWINDOWS}
  221.     property ImeMode;
  222.     property ImeName;
  223.     property ParentBiDiMode;
  224. {$ENDIF}
  225.     property PopupMenu;
  226. {$IFDEF MSWINDOWS}
  227.     property OnEndDock;
  228.     property OnStartDock;
  229. {$ENDIF}
  230.     property OnStartDrag;
  231. {$ENDIF}
  232. {$IFDEF DELPHI5_UP}
  233. {$ENDIF}
  234.   end;
  235.  
  236. const
  237.   TNEDIT_VERSION = 100;
  238.  
  239.   NumericTypes: array[TDataType] of string =
  240.     ('Integer', 'Cardinal',
  241.     'Shortint', 'Smallint', 'Longint',
  242. {$IFDEF DELPHI2_UP}
  243.     'Int64',
  244. {$ENDIF}
  245.     'Byte', 'Word',
  246. {$IFDEF DELPHI2_UP}
  247.     'Longword',
  248. {$ENDIF}
  249.     'Real', 'Real48', 'Single', 'Double', 'Extended', 'Comp'
  250. {$IFDEF DELPHI2_UP}
  251.     , 'Currency'
  252. {$ENDIF}
  253.     );
  254.  
  255. implementation
  256.  
  257. {------------------------------------------------------------------------------
  258.     Procedure: TNEdit.Create
  259.   Description: standard constructor
  260.        Author: Mat Ballard
  261.  Date created: 04/25/2000
  262. Date modified: 04/25/2000 by Mat Ballard
  263.       Purpose: sets the Text and DataType
  264.  Known Issues:
  265.  ------------------------------------------------------------------------------}
  266. constructor TNEdit.Create(AOwner:TComponent);
  267. begin
  268.   inherited Create(AOwner);
  269.   Text := '0';
  270.   DataType := dtInteger;
  271. end;
  272.  
  273. {------------------------------------------------------------------------------
  274.     Procedure: TNEdit.KeyDown
  275.   Description: standard KeyDown event handler
  276.        Author: Mat Ballard
  277.  Date created: 04/25/2000
  278. Date modified: 04/25/2000 by Mat Ballard
  279.       Purpose: examines Key to see if valid
  280.  Known Issues:
  281.  ------------------------------------------------------------------------------}
  282. Procedure TNEdit.KeyDown(var Key: Word; Shift: TShiftState);
  283. var
  284.   KeyOK: Boolean;
  285.  
  286.   function IsInteger: Boolean;
  287.   begin
  288.     if ((Ord('1') <= Key) and (Key <= Ord('9'))) then
  289.       Result := TRUE
  290.      else
  291.       Result := FALSE;
  292.   end;
  293.  
  294. begin
  295.   KeyOK := FALSE;
  296.   if (Key < VK_SPACE) then {32}
  297.     KeyOK := TRUE
  298.   else if (Key > Ord('~')) then
  299.     KeyOK := TRUE
  300.   else if ((Key = Ord('-')) and
  301.     (FMin < 0)) then
  302.       KeyOK := TRUE
  303.   else
  304.   begin
  305.     case FNumericType of
  306.       ntBinary:
  307.         if ((Key = Ord('0')) or (Key = Ord('1'))) then
  308.           KeyOK := TRUE;
  309.       ntInteger: KeyOK := IsInteger;
  310.       ntHex:
  311.         if IsInteger or
  312.           ((Ord('A') <= Key) and (Key <= Ord('F'))) or
  313.           ((Ord('a') <= Key) and (Key <= Ord('f'))) then
  314.             KeyOK := TRUE;
  315.       ntFixed, ntCurrency:
  316.         if (IsInteger or
  317.           (Key = Ord('.'))) then
  318.             KeyOK := TRUE;
  319.       ntScientific:
  320.         if (IsInteger or
  321.           (Key = Ord('.')) or
  322.           (Key = Ord('e')) or
  323.           (Key = Ord('E')) or
  324.           (Key = Ord('-'))) then
  325.           KeyOK := TRUE;
  326.     end;
  327.   end;
  328.  
  329.   if (KeyOK) then
  330. {call the TEdit parent function last:}
  331.     inherited KeyDown(Key, Shift);
  332. end;
  333.  
  334. {------------------------------------------------------------------------------
  335.     Procedure: TNEdit.SetNumericType
  336.   Description: standard property Set procedure
  337.        Author: Mat Ballard
  338.  Date created: 04/25/2000
  339. Date modified: 04/25/2000 by Mat Ballard
  340.       Purpose: sets the NumericType Property
  341.  Known Issues:
  342.  ------------------------------------------------------------------------------}
  343. procedure TNEdit.SetNumericType(Value: TNumericType);
  344. begin
  345.   if (Value = FNumericType) then exit;
  346.  
  347.   FNumericType := Value;
  348. end;
  349.  
  350. {------------------------------------------------------------------------------
  351.     Procedure: TNEdit.SetDataType
  352.   Description: standard property Set procedure
  353.        Author: Mat Ballard
  354.  Date created: 04/25/2000
  355. Date modified: 04/25/2000 by Mat Ballard
  356.       Purpose: sets the DataType Property
  357.  Known Issues:
  358.  ------------------------------------------------------------------------------}
  359. procedure TNEdit.SetDataType(Value: TDataType);
  360. begin
  361.   if (Value = FDataType) then exit;
  362.  
  363.   FDataType := Value;
  364.   case FDataType of
  365.     dtInteger:
  366.       begin
  367.         FMin := Low(Integer);
  368.         FMax := High(Integer);
  369.       end;
  370.     dtCardinal:
  371.       begin
  372.         FMin := Low(Cardinal);
  373.         FMax := High(Cardinal);
  374.       end;
  375.     dtShortint:
  376.       begin
  377.         FMin := Low(Shortint);
  378.         FMax := High(Shortint);
  379.       end;
  380.     dtSmallint:
  381.       begin
  382.         FMin := Low(Smallint);
  383.         FMax := High(Smallint);
  384.       end;
  385.     dtLongint:
  386.       begin
  387.         FMin := Low(Longint);
  388.         FMax := High(Longint);
  389.       end;
  390. {$IFDEF DELPHI4_UP}
  391.     dtInt64:
  392.       begin
  393.         FMin := Low(Int64);
  394.         FMax := High(Int64);
  395.       end;
  396. {$ENDIF}
  397.     dtByte:
  398.       begin
  399.         FMin := Low(Byte);
  400.         FMax := High(Byte);
  401.       end;
  402.     dtWord:
  403.       begin
  404.         FMin := Low(Word);
  405.         FMax := High(Word);
  406.       end;
  407. {$IFDEF DELPHI4_UP}
  408.     dtLongword:
  409.       begin
  410.         FMin := Low(Longword);
  411.         FMax := High(Longword);
  412.       end;
  413. {$ENDIF}
  414.  
  415. {now the reals:}
  416.     dtReal48:
  417.       begin
  418.         {FMin := 2.9e-39;}
  419.         FMax := 1.7e38;
  420.         FMin := -FMax;
  421.       end;
  422.     dtSingle:
  423.       begin
  424.         {FMin := 1.5e-45;}
  425.         FMax := 3.4e38;
  426.         FMin := -FMax;
  427.       end;
  428.     dtDouble, dtReal:
  429.       begin
  430.         {FMin := 5.0e-324;}
  431.         FMax := 1.7e308;
  432.         FMin := -FMax;
  433.       end;
  434.     dtExtended:
  435.       begin
  436.         {FMin := 3.6e-4951;}
  437.         FMax := 1.1e4932;
  438.         FMin := -FMax;
  439.       end;
  440.     dtComp:
  441.       begin
  442.         FMin := -IntPower(2, 63) + 1;
  443.         FMax := IntPower(2, 63) -1;
  444.       end;
  445. {$IFDEF DELPHI2_UP}
  446.     dtCurrency:
  447.       begin
  448.         FMin := -922337203685477.5808;
  449.         FMax := 922337203685477.5807;
  450.       end;
  451. {$ENDIF}
  452.   end;
  453.   case FDataType of
  454.     dtInteger .. {$IFDEF DELPHI2_UP}dtLongword{$ELSE}dtWord{$ENDIF}:
  455.       if not ((FNumericType = ntInteger) or
  456.               (FNumericType = ntBinary) or
  457.               (FNumericType = ntHex)) then
  458.         NumericType := ntInteger;
  459. {$IFDEF DELPHI2_UP}
  460.     dtCurrency:
  461.       NumericType := ntCurrency;
  462. {$ENDIF}
  463.     else
  464.       if not ((FNumericType = ntFixed) or
  465.               (FNumericType = ntScientific)) then
  466.         NumericType := ntScientific;
  467.   end;
  468. end;
  469.  
  470. {------------------------------------------------------------------------------
  471.      Function: TNEdit.IsValid
  472.   Description: examines Text to determine if it is a valid number
  473.        Author: Mat Ballard
  474.  Date created: 04/25/2000
  475. Date modified: 04/25/2000 by Mat Ballard
  476.       Purpose: see Description
  477.  Return Value: TRUE or FALSE
  478.  Known Issues:
  479.  ------------------------------------------------------------------------------}
  480. function TNEdit.IsValid: Boolean;
  481. var
  482.   RealValue: Extended;
  483.   TheResult: Boolean;
  484. begin
  485.   try
  486.     TheResult := TRUE;
  487.     case FDataType of
  488.       dtInteger .. dtWord:
  489.         begin
  490.           if (FNumericType = ntHex) then
  491.             RealValue := StrToInt('$' + Text)
  492.            else
  493.             RealValue := StrToInt(Text);
  494.         end;
  495. {$IFDEF DELPHI2_UP}
  496.       dtLongword:
  497.         RealValue := StrToInt(Text);
  498.       dtCurrency:
  499.         RealValue := StrToCurr(Text);
  500. {$ENDIF}
  501.     else
  502.       RealValue := StrToFloat(Text);
  503.     end;
  504.     if ((RealValue < FMin) or
  505.         (RealValue > FMax)) then
  506.       TheResult := FALSE;
  507.   except
  508.     TheResult := FALSE;
  509.   end;
  510.   if (not TheResult) then
  511.   begin
  512.     raise EConvertError.CreateFmt(Text + ' is not a valid %s between %g and %g',
  513.       [NumericTypes[FDataType], FMin, FMax]);
  514.   end;    
  515.   IsValid := TheResult;
  516. end;
  517.  
  518. {------------------------------------------------------------------------------
  519.     Procedure: TNEdit.DoExit
  520.   Description: standard DoExit event handler
  521.        Author: Mat Ballard
  522.  Date created: 04/25/2000
  523. Date modified: 04/25/2000 by Mat Ballard
  524.       Purpose: examines the validity of the Text
  525.  Known Issues:
  526.  ------------------------------------------------------------------------------}
  527. procedure TNEdit.DoExit;
  528. begin
  529.   IsValid;
  530.   inherited DoExit;
  531. end;
  532.  
  533. {------------------------------------------------------------------------------
  534.      Function: TNEdit.GetReal
  535.   Description: standard property Get function
  536.        Author: Mat Ballard
  537.  Date created: 04/25/2000
  538. Date modified: 04/25/2000 by Mat Ballard
  539.       Purpose: gets the value of the Text Property as a Real
  540.  Return Value: Extended
  541.  Known Issues:
  542.  ------------------------------------------------------------------------------}
  543. function TNEdit.GetReal: Extended;
  544. begin
  545.   {Result := 0;}
  546.   try
  547.     Result := StrToFloat(Text);
  548.   except
  549.     Result := 0;
  550.   end;
  551. end;
  552.  
  553. {------------------------------------------------------------------------------
  554.      Function: TNEdit.GetInteger
  555.   Description: standard property Get function
  556.        Author: Mat Ballard
  557.  Date created: 04/25/2000
  558. Date modified: 04/25/2000 by Mat Ballard
  559.       Purpose: gets the value of the Text Property as an Integer
  560.  Return Value: IntEGER
  561.  Known Issues:
  562.  ------------------------------------------------------------------------------}
  563. function TNEdit.GetInteger: Integer;
  564. begin
  565.   {Result := 0;}
  566.   try
  567.     if (FNumericType = ntHex) then
  568.       Result := StrToInt('$' + Text)
  569.      else
  570.       Result := StrToInt(Text);
  571.   except
  572.     try
  573.       Result := Round(StrToFloat(Text));
  574.     except
  575.       Result := 0;
  576.     end;
  577.   end;
  578. end;
  579.  
  580. {$IFDEF DELPHI4_UP}
  581. {------------------------------------------------------------------------------
  582.      Function: TNEdit.GetInt64
  583.   Description: standard property Get function
  584.        Author: Mat Ballard
  585.  Date created: 11/25/2000
  586. Date modified: 11/25/2000 by Mat Ballard
  587.       Purpose: gets the value of the Text Property as an Integer
  588.  Return Value: Int64
  589.  Known Issues:
  590.  ------------------------------------------------------------------------------}
  591. function TNEdit.GetInt64: Int64;
  592. begin
  593.   //Result := 0;
  594.   try
  595.     if (FNumericType = ntHex) then
  596.       Result := StrToInt64('$' + Text)
  597.      else
  598.       Result := StrToInt64(Text);
  599.   except
  600.     try
  601.       Result := Round(StrToFloat(Text));
  602.     finally
  603.     end;
  604.   end;
  605. end;
  606. {$ENDIF}
  607.  
  608. {------------------------------------------------------------------------------
  609.      Function: TNEdit.GetCurrency
  610.   Description: standard property Get function
  611.        Author: Mat Ballard
  612.  Date created: 04/25/2000
  613. Date modified: 04/25/2000 by Mat Ballard
  614.       Purpose: gets the value of the Text Property as Currency
  615.  Return Value: Currency
  616.  Known Issues:
  617.  ------------------------------------------------------------------------------}
  618. {$IFDEF DELPHI2_UP}
  619. function TNEdit.GetCurrency: Currency;
  620. begin
  621.   //Result := 0;
  622.   try
  623.     GetCurrency := StrToCurr(Text);
  624.   finally
  625.   end;
  626. end;
  627. {$ENDIF}
  628.  
  629. {------------------------------------------------------------------------------
  630.     Procedure: TNEdit.SetReal
  631.   Description: standard property Set procedure
  632.        Author: Mat Ballard
  633.  Date created: 04/25/2000
  634. Date modified: 04/25/2000 by Mat Ballard
  635.       Purpose: sets the Text Property numerically
  636.  Known Issues:
  637.  ------------------------------------------------------------------------------}
  638. procedure TNEdit.SetReal(Value: Extended);
  639. begin
  640.   case FDataType of
  641.     dtReal, dtReal48, dtSingle, dtDouble, dtExtended, dtComp: ;
  642.     else DataType := dtExtended; {this then sets numeric type}
  643.   end;
  644.   Text := FloatToStr(Value);
  645. end;
  646.  
  647. {------------------------------------------------------------------------------
  648.     Procedure: TNEdit.SetInteger
  649.   Description: standard property Set procedure
  650.        Author: Mat Ballard
  651.  Date created: 04/25/2000
  652. Date modified: 04/25/2000 by Mat Ballard
  653.       Purpose: sets the Text Property numerically
  654.  Known Issues:
  655.  ------------------------------------------------------------------------------}
  656. procedure TNEdit.SetInteger(Value: Integer);
  657. begin
  658.   case FDataType of
  659.     dtInteger .. {$IFDEF DELPHI2_UP}dtLongword{$ELSE}dtWord{$ENDIF}: ;
  660.     else DataType := dtInteger; {this then sets numeric type}
  661.   end;
  662.  
  663.   if (FNumericType = ntHex) then
  664.     Text := IntToHex(Value, 0)
  665.    else
  666.     Text := IntToStr(Value);
  667. end;
  668.  
  669. {$IFDEF DELPHI4_UP}
  670. {------------------------------------------------------------------------------
  671.     Procedure: TNEdit.SetInt64
  672.   Description: standard property Set procedure
  673.        Author: Mat Ballard
  674.  Date created: 11/25/2000
  675. Date modified: 11/25/2000 by Mat Ballard
  676.       Purpose: sets the Text Property numerically
  677.  Known Issues:
  678.  ------------------------------------------------------------------------------}
  679. procedure TNEdit.SetInt64(Value: Int64);
  680. begin
  681.   case FDataType of
  682.     dtInteger .. {$IFDEF DELPHI2_UP}dtLongword{$ELSE}dtWord{$ENDIF}: ;
  683.     else DataType := dtInteger; {this then sets numeric type}
  684.   end;
  685.  
  686.   if (FNumericType = ntHex) then
  687.     Text := IntToHex(Value, 0)
  688.    else
  689.     Text := IntToStr(Value);
  690. end;
  691. {$ENDIF}
  692.  
  693. {------------------------------------------------------------------------------
  694.     Procedure: TNEdit.SetCurrency
  695.   Description: standard property Set procedure
  696.        Author: Mat Ballard
  697.  Date created: 04/25/2000
  698. Date modified: 04/25/2000 by Mat Ballard
  699.       Purpose: sets the Text Property numerically
  700.  Known Issues:
  701.  ------------------------------------------------------------------------------}
  702. {$IFDEF DELPHI2_UP}
  703. procedure TNEdit.SetCurrency(Value: Currency);
  704. begin
  705.   FDataType := dtCurrency;
  706.   Text := CurrToStr(Value);
  707. end;
  708. {$ENDIF}
  709.  
  710.  
  711. end.
  712.