Characters changed in TWinControl.KeyPress will not enter changed; original character is entered
Original Reporter info from Mantis: Xenon
-
Reporter name: Xenon
Original Reporter info from Mantis: Xenon
- Reporter name: Xenon
Description:
When I change a character in a KeyPress event, the character will, in effect, not be changed. Example: I want to make all characters upper case and do that in KeyPress. When I enter a lower case character (e.g. "u") it should appear as the upper case character ("U"). However, it does not; the original "u" appears.
Same if I use UTF8KeyPress.
Steps to reproduce:
E.g.: Make form. Put Memo1: TMemo on it. Create Event Memo.KeyPress. Enter Key := 'P' (so that all entries will be changed into 'P'). Run. Enter a character into Memo 1 (such as 'u', or any other, which should be changed into 'P' because of your KeyPress event. Result: Memo will show the original character, in this case 'u'. The KeyPress event will in effect be ignored.
Use Application in LazarusTestCase.zip named pr_keypressproblem.lpi
Additional information:
contains unit gtk2proc.pp. Works with TGtk2WidgetSet.
I tracked it down until method TWinControl.CNChar(var Message: TLMKeyUp) in file wincontrol.inc (unit wincontrol?); the variable Message contains the changed character; however, this is not used in the end.
Mantis conversion info:
- Mantis ID: 33091
- Build: SVN-Rev. Debian pack. 1.6+dfsg-1