Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 4 of 4 total
Thread TEdit - InputType := Number error?
Tue, Feb 23 2016 9:17 PMPermanent Link

Trinione

Entering letters after numbers is accepted for a TEdit object InputType := tiNumber

Example, the following are accepted:
25ddd
23.33dddd
25`dddddd

How to get to correctly accept numbers and decimal point only?
Wed, Feb 24 2016 6:49 AMPermanent Link

Walter Matte

Tactical Business Corporation

Code your own KeyPress to accept only the characters you want.

This was from a grid...

function TfrmTime.grdDetKeyPress(Sender: TObject; Key: Char; ShiftKey, CtrlKey, AltKey: Boolean): Boolean;
begin
 if grdBD.ColumnIndex = 1 then
 begin
   if (ShiftKey) or (CTRLKey) or (ALTKey) then
   begin
     result := false;
   end
   else
   begin
   if IsDigit(Key) or (Key = '.') then
     result := true
   else
     result := false;
   end;
 end
 else
 begin
   result := true;
 end;
end;


Walter
Wed, Feb 24 2016 3:48 PMPermanent Link

Trinione

Walter:

<< Code your own KeyPress to accept only the characters you want. >>

Thank you. It works.
Thu, Feb 25 2016 11:48 AMPermanent Link

Matthew Jones

Trinione wrote:

>  InputType := tiNumber

The key here is that it tells the browser information, not anything
else. So on an iPhone, it will show the numeric keyboard which speeds
input of such numbers. The validation is down to you though.

--

Matthew Jones
Image