Home > Blockchain >  TSearchBox.OnKeyUp event ignores ENTER key in Delphi 11
TSearchBox.OnKeyUp event ignores ENTER key in Delphi 11

Time:09-23

When using a TSearchBox control in Delphi, I catch pressing the ENTER key (13) to run a certain function. Simply by:

If key = 13 then DoSomeThing;

After updating to Delphi 11, this doesn't work anymore. I can catch any character but not 13.

Any ideas?

CodePudding user response:

This is intentional! Before Delphi 11, TSearchBox meant to handle VK_RETURN in its KeyPress() method, but failed to do so because it didn't even get that key. In Delphi 11, this has been fixed by having TSearchBox handle CM_WANTSPECIALKEY.

The corresponding QP report is RSP-30203: TSearchBox must implement CM_WANTSPECIALKEY

  • Related