TFloatEdit/TSpinFloatEdit readme
- TFloatEdit is a descendant of TEdit to enter and check floating point numbers (min/max, number of decimal digits).
- TSpinFloatEdit is based on this, it also implements increment/decrement buttons and keystrokes and also "dynamic" inc/dec via an event handler.
TFloatEdit, TSpinFloatEdit components for borland delphi
V 1.13, january 28, 2001
borland delphi 4.xx
- copy or extract fledit.pas and fledit.dcr into a folder included in delphi's search path (like $(DELPHI)\lib).
- select "component"->"install component" in delphi's main menu.
- type fledit.pas into the "unit name" edit box.
- select "OK".
- after the component package is opened in delphi, click "compile".
- then, after recompilation of the package, you should find the components on the "mirkes.de" component palette tab.
TFloatEdit
added published properties:
- Digits: Byte (r/w)
the number of decimal digits (digits after the decimal separator), range 0..18
- Min: Extended (r/w)
the lowest valid value
- Max: Extended (r/w)
the highest valid value
- Value: Extended (r/w)
the current value
- ErrorMessage :string (r/w)
the message that will be displayed if an invalid (not a number, out of range) value is typed
in the edit box, if this is the empty string ("", default), no error message will be displayed, and the value will be reset to a default
- Alignment: TAlignment (r/w)
how to align the text in the edit box (taLeftJustify, taCenter, taRightJustify (default))
- About: string (r)
shows the version and copyright holder of the component in the delphi ide, not editable
added events:
- OnEnterPress : TKeyPressEvent (r/w)
this event handler is called everytime the ENTER key is pressed
changed properties:
- Text: string (r)
this property is not writeable in TFloatEdit, you can just read the current value in textual format. to change the value, use the Value property instead
TSpinFloatEdit
TSpinFloatEdit inherits all properties of TCustomFloatEdit (like TFloatEdit), it additionally implements the following:
added types:
- TComputedIncrementEvent = procedure (Sender: TObject; const bIncrement:Boolean) of object;
this event handler is used in the OnComputedIncrement (see below) event
added published properties:
- EditorEnabled: Boolean (rw)
if this is set to flase (default is true), you cannot enter values in the edit box, you can just use the increment/decrement buttons and keys (up: CURSOR UP, down: CURSOR DOWN)
-
Increment: Extended (rw)
the value that is added to/substracted from the current value on increment/decrement event
added events:
- OnComputedIncrement : TComputedIncrement (r/w)
if a method is assigned to this event handler, it will be called whenever an increment/decrement event happens rather than adding/substracting the Increment property's value. the boolean parameter bIncrement tells you whether an increment (true) or decrement (false) event is occured. in this method you may implement your own increment/decrement algorithm
included
markus stephany, losheim am see, saarland, germany
mailto:merkes@mirkes.de
http://www.mirkes.de
Version 1.1
There was a bug in the range checking; I hope it is fixed now. In V1.0 the value has been checked at each onkeypress-event, and that was not very fine in some cases. Now the correctness of the value will be checked when the focus get lost. If the value isn't in the range of min-max, the focus can't get lost. And now, the user can press the ESC-Key in FloatEdit to restore the value that was set
before he made changes.
Version 1.2
- Added properties: Alignment, OnEnterPress
- credits to Giuseppe Mosca and Andrea Carli
Version 1.3, jan 28, 2001
- implemented a base class TCustomFloatEdit where TFloatEdit is derived from
- hopefully fixed a problem with different decimalseparators
- text property is no longer writable (use value instead)
- added a component TSplinFloatEdit (like TSpinEdit from Borland's sample
vcl, much of the code is just copy&paste'd from the sources,
not just fix increment/decrement, also computed - via event handler)
- credits to George Paraskevaidis
- credits to Borland for the TSpinEdit sample component
TFloatEdit, TSpinFloatEdit Copyright (C) 1997-2001 markus stephany
This package is free software; you can redistribute it and/or modify
it under the terms of either:
a) the GNU General Public License as published by the Free
Software Foundation; either version 2, or (at your option) any
later version, or
b) the GNU Lesser General Public License as published by the Free
Software Foundation; either version 2.1, or (at your option) any
later version.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
(Lesser) General Public License for more details.
You should have received a copy of the GNU General Public License
along with this package in the file named "COPYING".
You should also have received a copy of the GNU Lesser General Public
License along with this package in the file named "COPYING.lesser"; if not,
write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,
Boston, MA 02111-1307, USA.
-END-