TFloatEdit/TSpinFloatEdit/TDBFloatEdit components by
mirkes.de
TFloatEdit is a descendant of TCustomEdit which is
able to edit and check floating point values. You can set
minimum and maximum values and the number of digits to
display.
TSpinFloatEdit is derived from TFloatEdit. It
additionally implements increment and decrement buttons. You
can define a static increment value to use when those buttons
are clicked or compute the increment using an event
handler.
TDBFloatEdit is a database aware version of
TFloatEdit. It has initially been written by Eddie
Shipman.
contents:
version:
version 06-15-2004, released june 15, 2004
target:
the package has been tested and is supposed to work in
Borland Delphi 4, 6 and 7 (TDBFloatEdit has not been tested on
Delphi 7).
sources:
the component sources are included in the package.
history:
version 06-15-2004, june 15, 2004
- changed SetMin and SetMax to allow temporary invalid
values during component loading and check them after the
component is loaded. thanks to Thorsten Brandt
- updated TDBFloatEdit to reflect the changes since version
1.2
- changed version numbering (now the version reflects the
release date)
version 1.5, jan 27, 2003
- there was a problem when a minimum value of e.g. 2 was
set, it wasn't possible to type the number '10'! thanks to
Heino Kappler
version 1.4, jan 27, 2003
- some problems with return/escape keys fixed
- multiline style avoided on newer operating systems (this
does not affect TSpinFloatEdit, it's always a multiline edit
control)
- on win98/me/2k/xp+ escape/return now are only handled by
the component itself if no cancel/default buttons are on the
form. thanks to Moz
version 1.3c, nov 19, 2002
- entering numbers in scientific notation should now work
better (reported by Scott Westfall and others)
version 1.3b, oct 27, 2001
- bugfix: OnExit had been called twice, thanks to
Philippe Oppliger
- included a DB aware version of TFloatEdit 1.2
(TDBFloatEdit in dbfloatedit.pas), written by Eddie
Shipman, many thanks!
version 1.3a, feb 23, 2001
- changed the license from GNU LGPL to the Clarified
Artistic License
version 1.3, jan 28, 2001
- implemented a base class TCustomFloatEdit which is the
ancestor of TFloatEdit
- 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
version 1.2
- added properties: Alignment, OnEnterPress
- credits to Giuseppe Mosca and Andrea
Carli
version 1.1
- there was a bug in range checking; i hope it is fixed
now. In v1.0 the value has been checked at each
onkeypress-event, and that was not a very good idea in some
cases. now the 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
- the user can press the ESC key in TFloatEdit to restore
the value that was set before he made changes
installation:
- copy or extract mpdelver.inc, fledit.pas
and fledit.dcr into a folder included in delphi's
search path (like $(DELPHI)\lib). if you have a database
aware version of delphi, you may additionally extract the
files dbfloatedit.pas and dbfloatedit.dcr to
install TDBFloatEdit.
- select "component"->"install component" in delphi's
main menu.
- type fledit.pas into the "unit name" edit
box.
- select "OK".
- (db-aware only:) select "add".
- (db-aware only:) type dbfloatedit.pas into the
"unit name" edit box.
- (db-aware only:) select "OK".
- after the component package is opened in delphi, click
"compile".
- after recompiling the package, you should find the
components on the "mirkes.de" component palette
page.
usage:
TFloatEdit, TDBFloatEdit
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, readonly
added events:
- OnEnterPress : TKeyPressEvent (r/w)
this event handler is called whenever the ENTER (RETURN) key
is pressed
changed properties:
- Text: string (r)
this property is readonly 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
(as TFloatEdit does), 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 False (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
contact:
the author of this package is markus stephany, losheim am
see, saarland, germany.
mailto:vcl[at]mirkes[dot]de
(change the obvious!)
http://www.mirkes.de
license:
*********************************************************************************************************************}
* *
* TFloatEdit, TSpinFloatEdit Copyright ©1997-2004 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 Clarified Artistic License as used by the authors of NCFTP *
* version 3.0.2. *
* *
* 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"; if not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, *
* Boston, MA 02111-1307, USA. *
* *
* You should also have received a copy of the Clarified Artistic *
* License along with this package in the file named "ARTISTIC"; if not, *
* you may find a copy at http://www.mirkes.de/downloads/ARTISTIC.txt *
* *
*********************************************************************************************************************}
-end-