Altering Utf8Key in OnUtf8KeyPress does not work correctly in native GTK2 controls
Original Reporter info from Mantis: Bart @flyingsheep
-
Reporter name: Bart Broersma
Original Reporter info from Mantis: Bart @flyingsheep
- Reporter name: Bart Broersma
Description:
When you try to change the value of an Utf8Key in a controls OnUtf8KeyPress event handler, this in amnybcases does not work as expected.
E.g. if in a TEdit I try to change Utf8Key "á" (without quotes) into "Ä" this does not work. The net effect in this case is that the key is dismissed.
I have keyboard layout Englis (US) latin1 with dead keys.
In order to type a "á" I type "'a" into the control.
Steps to reproduce:
Build and run the attached sample project.
When typing in any of the editable controls on the bottom, any "character" you type that is present in the edit labeled "Change this" will be converted into the corresponding (by place) "character" in the edit labeled "into this".
Here's the output of typing "abcáéí" into a TEdit and into a TSynEdit.
The TComboBox behaves as the TEdit.
OrigEdit.Text = abcáéí
Replaceedit.Text = xyzÄËÏ
Typing "abcáéí" (without the quotes) in TEdit
------------------------------------
Edit1.KeyDown: Key = 65
Edit1.Utf8KeyPress: Utf8Key = a -> a
Edit1.KeyPress: Key = a -> x
Edit1.Text = x
------------------------------------
------------------------------------
Edit1.KeyDown: Key = 66
Edit1.Utf8KeyPress: Utf8Key = b -> b
Edit1.KeyPress: Key = b -> y
Edit1.Text = xy
------------------------------------
------------------------------------
Edit1.KeyDown: Key = 67
Edit1.Utf8KeyPress: Utf8Key = c -> c
Edit1.KeyPress: Key = c -> z
Edit1.Text = xyz
------------------------------------
------------------------------------
Edit1.KeyDown: Key = 222
------------------------------------
Edit1.KeyDown: Key = 65
Edit1.Utf8KeyPress: Utf8Key = á -> Ä
------------------------------------
Edit1.KeyDown: Key = 222
------------------------------------
Edit1.KeyDown: Key = 69
Edit1.Utf8KeyPress: Utf8Key = é -> Ë
------------------------------------
Edit1.KeyDown: Key = 222
------------------------------------
Edit1.KeyDown: Key = 73
Edit1.Utf8KeyPress: Utf8Key = í -> Ï
Edit1.Text = xyzḮ
------------------------------------
OrigEdit.Text = abcáéí
Replaceedit.Text = xyzÄËÏ
Typing "abcáéí" (without the quotes) in TEdit
------------------------------------
SynEdit1.KeyDown: Key = 65
SynEdit1.Utf8KeyPress: Utf8Key = a -> a
SynEdit1.KeyPress: Key = a -> x
SynEdit1.Text = x
------------------------------------
------------------------------------
SynEdit1.KeyDown: Key = 66
SynEdit1.Utf8KeyPress: Utf8Key = b -> b
SynEdit1.KeyPress: Key = b -> y
SynEdit1.Text = xy
------------------------------------
------------------------------------
SynEdit1.KeyDown: Key = 67
SynEdit1.Utf8KeyPress: Utf8Key = c -> c
SynEdit1.KeyPress: Key = c -> z
SynEdit1.Text = xyz
------------------------------------
------------------------------------
SynEdit1.KeyDown: Key = 222
------------------------------------
SynEdit1.KeyDown: Key = 65
SynEdit1.Utf8KeyPress: Utf8Key = á -> Ä
SynEdit1.Text = xyzÄ
------------------------------------
------------------------------------
SynEdit1.KeyDown: Key = 222
------------------------------------
SynEdit1.KeyDown: Key = 69
SynEdit1.Utf8KeyPress: Utf8Key = é -> Ë
SynEdit1.Text = xyzÄË
------------------------------------
------------------------------------
SynEdit1.KeyDown: Key = 222
------------------------------------
SynEdit1.KeyDown: Key = 73
SynEdit1.Utf8KeyPress: Utf8Key = í -> Ï
SynEdit1.Text = xyzÄËÏ
------------------------------------
The SynEdit behaves as expected.
Mantis conversion info:
- Mantis ID: 26116
- OS: Linux
- OS Build: Fedora Core 18
- Build: r44929
- Platform: i386
- Version: 1.3 (SVN)