|
| [WD17] - Control what is typed in Edit Control |
| Iniciado por guest, 16,mar. 2015 12:19 - 5 respuestas |
| |
| | | |
|
| |
| Publicado el 16,marzo 2015 - 12: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?
TIA
Yogi Yang |
| |
| |
| | | |
|
| | |
| |
| Publicado el 16,marzo 2015 - 14:26 |
Hi
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 |
| |
| |
| | | |
|
| | |
| |
| Publicado el 18,marzo 2015 - 05:24 |
Fabric,
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.
TIA
Yogi Yang |
| |
| |
| | | |
|
| | |
| |
| Publicado el 18,marzo 2015 - 09:28 |
Yogi,
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: |
| |
| |
| | | |
|
| | |
| |
| Publicado el 18,marzo 2015 - 13:51 |
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. (<a class="ExternalLink" rel="nofollow" target="_blank" href="http://doc.windev.com/en-US/?9000126">http://doc.windev.com/en-US/…</a>)
Use KeyPressed() to know about state of Shift, Ctrl, etc.
Best regards, Alexandre Leclerc |
| |
| |
| | | |
|
| | |
| |
| Publicado el 19,marzo 2015 - 11:02 |
Alexandre,
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!
DarrenF,
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.
Regards,
Yogi Yang |
| |
| |
| | | |
|
| | | | |
| | |
|