Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 3 Jahren, 3 Monaten
Letzter Beitrag:
vor 3 Jahren, 3 Monaten
Beteiligte Autoren:
Yogi Yang, Alexandre Leclerc, Fabrice Harari, DarrenF

[WD17] - Control what is typed in Edit Control

Startbeitrag von Yogi Yang am 16.03.2015 11:19

I want to control as to what letters can be typed in an Edit Control. The basic idea is to map certain characters with other characters under certain situations.

Is it possible to do this in WD 17?


Yogi Yang



I'm not sure what you mean exactly, but if I understood correctly the question, you can put your code in the edit field in the "each modification" area and compare to the previous content to decide what to do

-OR- you can use events to intercept the input and decide there

Best regards

von Fabrice Harari - am 16.03.2015 13:26

You have understood most of what I want to achieve.

What I am trying is to control as to what is typed in the Edit control and what is not typed. Again what is typed as to be typed in a predefined sequence that will keep on changing based on a few factors which are dynamic.

I my software I am allowing my user to enter content for email. A kind of email template build by the user. While entering content for email I want to allow user to enter place holders which should be between angled braces (< place holder >) so if a user types the Left Angle Brace then he has to first type the place holder text and then only can type Right Angle Brace. All whatever the user types between angle braces has to be automatically converted lower case and when the user types space character it has to be converted to underscore ( _ ). Again if the user pressed the Enter/Return key withing angle braces that key has to be discarded (not typed)

I can achieve this only if I can detect as to which key is pressed by user and replace it with the key value I want.


Yogi Yang

von Yogi Yang - am 18.03.2015 04:24

I did a similar thing where the user could insert placeholder tags, but instead of the user manually entering a value, they pick a "tag" from a pop-up window which then inserts the placeholder, thus avoiding keying errors by the user - just thought I'd mention it as a different way of thinking :xcool:

von DarrenF - am 18.03.2015 08:28
Hi Yogi,

Use the second suggestion of Fabrice. Use the WM_CHAR event of the edit control. In the event, check _eve.wParam to get the key code. If you do not accept the key code, simply set _eve.Return = 0. This will cancel the key. (http://doc.windev.com/en-US/?9000126)

Use KeyPressed() to know about state of Shift, Ctrl, etc.

Best regards,
Alexandre Leclerc

von Alexandre Leclerc - am 18.03.2015 12:51

Thanks for your tips and suggestions. Actually I was not able to understand the second suggestion by Fabrice as it was very terse. Thanks for amplifying it. Now I am able to understand as to what I have to do and how I have to try and do it!


You suggestion of showing user list of tag/place holders and allowing them to select from them is good one but unfortunately in this particular instance I cannot use it. But I will keep this in mind.


Yogi Yang

von Yogi Yang - am 19.03.2015 10:02
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.