1. All Edit only allow input numbers, you can only enter a decimal point 2. Don't want to write onKeyPress events for up to dozens of edits.
Then you will write one, all of the other points in Object Inspector: Procedure TFORM1.EDIT1KEYPRESS (Sender: Tobject; Var Key: Char); Var IntCompidx: Integer; sttext: string; begin if (ORD (key) = 46 Then Begin IntCompidx: = (sender as tedit) .componentIndex; sttext: = tedit (Components [INTCompidx]). Text; if POS ('.', sttext)> 1 THEN Key: = # 0; end; end;
If you don't feel ugly, you can do any variables: if (ORD (Key) = 46) and (POS ('.', Tedit (Components) .ComponentIndex]). Text)> 1) Then Key: = # 0;