How can I set an edit control to be Latin-only? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
william_ahk
Posts: 499
Joined: 03 Dec 2018, 20:02

How can I set an edit control to be Latin-only?

25 Sep 2020, 19:02

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?
User avatar
mikeyww
Posts: 27161
Joined: 09 Sep 2014, 18:38

Re: How can I set an edit control to be Latin-only?

25 Sep 2020, 19:10

One workaround could be to set temporary hotkeys that ignore characters that should not appear.
tmplinshi
Posts: 1604
Joined: 01 Oct 2013, 14:57

Re: How can I set an edit control to be Latin-only?  Topic is solved

26 Sep 2020, 01:09

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
User avatar
mikeyww
Posts: 27161
Joined: 09 Sep 2014, 18:38

Re: How can I set an edit control to be Latin-only?

26 Sep 2020, 05:30

That looks cool. Does that DLL call disable the non-Latin input? How does it do that?
william_ahk
Posts: 499
Joined: 03 Dec 2018, 20:02

Re: How can I set an edit control to be Latin-only?

27 Oct 2020, 07:29

@tmplinshi This is really gool (good&cool)! Thank you so much

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: AlFlo, arrondark, TAC109 and 112 guests