TIP: Click on subject to list as thread! ANSI
echo: delphi
to: VITALIK MELEHIN
from: GARY WEINFURTHER
date: 1997-06-07 16:08:00
subject: TEdit-like element

Vitalik Melehin mentioned this to All:
 VM>   Tell me plz somebody: Do have Delphi2 standart TEdit-like element, 
hat
 VM> work with Integer, etc. types, but not with string?
No, but it is easy to restrict a TEdit to only numbers.  Just put the 
following code into the TEdit's OnKeyPress handler:
procedure TForm1.Edit1KeyPress(Sender : TObject; var Key : Char);
const
    BACKSPACE = #8;
begin
    if not (Key in ['0'..'9', BACKSPACE]) then
        Key := #0;
end;
This handler can be shared among multiple TEdit controls on the same form.
                                ...Gary
--- GoldED 2.41
---------------
* Origin: The Flying Circus BBS, Farmington Hills, MI. (1:2410/905)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.