Page MenuHomeFeedback Tracker

[Feature request] Make onChar UIEH be able to block text input
New, NormalPublic


Similar to the onKeyDown UIEH the onChar UIEH should be able to intercept input from the user. This would open up the possibility to use onChar for a CT_EDIT control to only accept certain characters, such as numbers. The same functionality is currently only possible with an onKeyDown UIEH that either checks the DIK code (unreliable due to different keyboard layouts as well as inelegant for eg numbers as you have to compare top row numbers AND numpad DIK codes) or compare the texts in the next frame to check for not allowed chars.


Operating System
Windows 10 x64
Feature Request
Steps To Reproduce

An example mission with the intended use is attached. The description.ext contains the onChar UIEH.

Event Timeline

7erra created this task.Aug 24 2020, 3:02 PM
7erra added a comment.Aug 24 2020, 4:38 PM

If retrocompatibility is a concern then another idea would be to add a new config entry:

class MyEdit: RscEdit
    allowedChars[] = {48, 49, 50, 51, 52, 53, 54, 55, 56, 57};
h- added a subscriber: h-.Aug 24 2020, 9:13 PM