How to restrict edit control to accept only english language characters
-
Do we have any way to restrict the edit control to only support accepting english characters/numbers?. If we make a simple edit control i.e. non-rich edit control, is it dependent on the target system and the keyboard settings that edit control accepts the character, for eg. if we create a simple edit control, and run our application on chinese system, would the user be able to type in chinese characters in to this control, if yes, is there any way to force the user to enter the text only in english language irrespective of his system language. Thanks for you responses in advance! Regards Suyash
-
Do we have any way to restrict the edit control to only support accepting english characters/numbers?. If we make a simple edit control i.e. non-rich edit control, is it dependent on the target system and the keyboard settings that edit control accepts the character, for eg. if we create a simple edit control, and run our application on chinese system, would the user be able to type in chinese characters in to this control, if yes, is there any way to force the user to enter the text only in english language irrespective of his system language. Thanks for you responses in advance! Regards Suyash
-
Do we have any way to restrict the edit control to only support accepting english characters/numbers?. If we make a simple edit control i.e. non-rich edit control, is it dependent on the target system and the keyboard settings that edit control accepts the character, for eg. if we create a simple edit control, and run our application on chinese system, would the user be able to type in chinese characters in to this control, if yes, is there any way to force the user to enter the text only in english language irrespective of his system language. Thanks for you responses in advance! Regards Suyash
Suyash wrote:
...is there any way to force the user to enter the text only in english language irrespective of his system language.
Is that useful? Wouldn't that be irritating to the Chinese user?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
-
override the
WM_CHAR
even for that editBox... but as David told, consider seriously thinking about why you need this (what problem you're trying to solve), and if you cannot solve your problem another way...With Richedit controls you can set the EM_NOIME style, this will prevent the user from being able to type chinese characters.Edit controls do not have this feature so you would have to go one step further and handle the WM_IME_CHAR and WM_IME_COMPOSITION yourself. But they would still have the option of being able to paste. Really there is no simple way to prevent it. You could override the WM_CHAR, but this would involve comparing each character entered against those in the charset GB5 for traditional and GB2312 for simplified. Or limit it even further by only allowing charcters a-z and A-Z, but here you would have problems telling the difference between single byte and multibyte characters. Another option is to set the font for the control to a font other than system and chinese. This would cause the control to display a special character (usually a box,star or Question mark) for those characters not found in the font.
-
With Richedit controls you can set the EM_NOIME style, this will prevent the user from being able to type chinese characters.Edit controls do not have this feature so you would have to go one step further and handle the WM_IME_CHAR and WM_IME_COMPOSITION yourself. But they would still have the option of being able to paste. Really there is no simple way to prevent it. You could override the WM_CHAR, but this would involve comparing each character entered against those in the charset GB5 for traditional and GB2312 for simplified. Or limit it even further by only allowing charcters a-z and A-Z, but here you would have problems telling the difference between single byte and multibyte characters. Another option is to set the font for the control to a font other than system and chinese. This would cause the control to display a special character (usually a box,star or Question mark) for those characters not found in the font.
-
Walder, welcome back ;P i'm sorry to be opposed to you again, but i'm not the one who asked the question ;) sorry for the disapointment :->
LOL, don't worry. I'm just under a bit of pressure to get this application finished. But one things for sure, I won't be asking questions again if I can help it.
-
LOL, don't worry. I'm just under a bit of pressure to get this application finished. But one things for sure, I won't be asking questions again if I can help it.
-
With Richedit controls you can set the EM_NOIME style, this will prevent the user from being able to type chinese characters.Edit controls do not have this feature so you would have to go one step further and handle the WM_IME_CHAR and WM_IME_COMPOSITION yourself. But they would still have the option of being able to paste. Really there is no simple way to prevent it. You could override the WM_CHAR, but this would involve comparing each character entered against those in the charset GB5 for traditional and GB2312 for simplified. Or limit it even further by only allowing charcters a-z and A-Z, but here you would have problems telling the difference between single byte and multibyte characters. Another option is to set the font for the control to a font other than system and chinese. This would cause the control to display a special character (usually a box,star or Question mark) for those characters not found in the font.
waldermort wrote:
With Richedit controls you can set the EM_NOIME style...
Perhaps you meant
ES_NOIME
?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
-
waldermort wrote:
With Richedit controls you can set the EM_NOIME style...
Perhaps you meant
ES_NOIME
?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
haha, so I did. I have no excuse, the 'S' and 'M' are too far apart to blame the keyboard. So, if anybody ask's, it was the wife ;)
-
Suyash wrote:
...is there any way to force the user to enter the text only in english language irrespective of his system language.
Is that useful? Wouldn't that be irritating to the Chinese user?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
DavidCrow wrote:
Is that useful? Wouldn't that be irritating to the Chinese user?
Hello All, Thanks for your replies and suggestion to the given problem, I would try to apply ES_NOIME solution as suggested. Regarding this requirement, actually we do have a poker table client, wherein various players from various contries(usa, china etc. etc.) will be able to play on the same table. Each player may have his/her own different language version of our software. However we also provide a chat facility, its all lobby chat, and personal chat is allowed. and its possible that 2 chinese player, if allowed to chat in chinese language(which other players may not know), can collude and cheat other players, so thats the reason we wish to restrict the chat input window to support only the english characters. Though we understand that there is no way to prohibit languages that uses english character set, like german. Thanks again! Regards Suyash