Windows 7 SP1 x64
RAD Studio 10.1 Berlin Update 2
TMS VCL UI Pack v10.0.2.0
I've encountered an undesired behaviour with TAdvEdit.OnKeyDown.
We cannot receive OnKeyDown when we press the left key on a TAdvEdit with a suffix while on the last character.
Similarly, we cannot receive OnKeyDown when we press the right key on a TAdvEdit with a prefix while on the first character.
The TCustomAdvEdit.WMKeyDown do not propagate the key down in those conditions.
By adding the following line on line 2964 of the AdvEdit unit, the keydown propagate like I would expect
if Assigned(OnKeyDown) then
OnKeyDown(Self, msg.CharCode, ss);
I trying to allow the user to change edit using the left key at the end of the edit and right at the beginning of the edit, like they are one single edit.
Add a TAdvEdit on a form with properties Text=''; Prefix='Prefix'; Suffix='Suffix'.
Add an onkeydown event, like:
procedure TForm1.AdvEdit1KeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
Caption := 'I did something!'
Run the application and focus the edit.
When pressing the Left key, the form Caption do not change.
When pressing the Right key, the form Caption do not change.
The desired effect would be that the Caption does change after pressing those keys.
If this something that could be fixed?
If not, what is the use case that needs those keydown to be suppressed?