Jump to content

KeyPress numeric only


RobYost

Recommended Posts

I am trying to use the keypress event to disallow some keys in a TUniDateTimePicker.

 

But even if I use:

procedure TfraTIncome.edtDatePaidKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
    Key := 0;
end;

procedure TfraTIncome.edtDatePaidKeyPress(Sender: TObject; var Key: Char);
begin
    Key := #0;
end;

It still lets me type anything.

Link to comment
Share on other sites

By the way Rob - since these are now web apps, you really don't want to go down the road of trapping a key-press event as it will require a trip to the server with every key pressed, for these kind of things it is best to do it on the browser side with JS. It takes some time to get the mindset right but I find myself thinking twice now before just putting some code behind a Delphi event.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...