GTK2: TCustomEdit.NumbersOnly not implemented
Original Reporter info from Mantis: biloky @biloky
-
Reporter name: Joeny Ang
Original Reporter info from Mantis: biloky @biloky
- Reporter name: Joeny Ang
Description:
Can't find anything on GTK to do this. Here are 2 ways to attain this:
v1. Override TWinControl.UTF8KeyPress() and filter key presses there. This will affect all widgetsets, and will override their implementations.
v2. Override TWinControl.UTF8KeyPress(), introduce TWSWidgetSet.DoUTF8KeyPress() and call this from the former. This will allow widgetsets to implement their own DoUTF8KeyPress().
Observations when NumbersOnly is True:
Win32 (Windows XP):
- only numeric chars are allowed via keyboard
- when a non-numeric char is pressed, will display a popup message (Unacceptable Character...)
- strings containing non-numeric chars can still be assigned to the Text property
QT5:
- if Text is purely numeric, only numeric chars are allowed via keyboard; if not, all chars are allowed
- strings containing non-numeric chars can still be assigned to the Text property
The patches will have the following behavior for GTK2:
- only numeric chars are allowed via keyboard
- strings containing non-numeric chars can still be assigned to the Text property
Mantis conversion info:
- Mantis ID: 37277
- Version: 2.1 (SVN)
- Fixed in revision: r63910 (#440fd1ab)