Page 1 of 1
How can I set an edit control to be Latin-only?
Posted: 25 Sep 2020, 19:02
by william_ahk
When an input method is on one would have to switch it off to enter latin letters directly, is there any way to make an edit control declare that it only accepts latin letters, temporarily switch to English input, and switch back after losing focus?
Re: How can I set an edit control to be Latin-only?
Posted: 25 Sep 2020, 19:10
by mikeyww
One workaround could be to set
temporary hotkeys that ignore characters that should not appear.
Re: How can I set an edit control to be Latin-only? Topic is solved
Posted: 26 Sep 2020, 01:09
by tmplinshi
Code: Select all
DisableControlIME(hWnd, bDisable := true) {
flag := bDisable ? 0x0020 ; IACE_IGNORENOCONTEXT
: 0x0010 ; IACE_DEFAULT
DllCall("Imm32\ImmAssociateContextEx", "ptr", hWnd, "ptr", 0, "uint", flag)
}
; Example
Gui, Add, Edit, xm w300 +HwndhEdit,
Gui, Add, Checkbox, x+10 hp vcb2 gDisableIME, Disable IME
Gui, Add, Edit, xm w300,
Gui, Show
Return
DisableIME:
GuiControlGet, b,, % A_GuiControl
DisableControlIME(hEdit, b)
Return
GuiClose:
ExitApp
Re: How can I set an edit control to be Latin-only?
Posted: 26 Sep 2020, 05:30
by mikeyww
That looks cool. Does that DLL call disable the non-Latin input? How does it do that?
Re: How can I set an edit control to be Latin-only?
Posted: 27 Oct 2020, 07:29
by william_ahk
@tmplinshi This is really gool (good&cool)! Thank you so much