Fastedit icon indicating copy to clipboard operation
Fastedit copied to clipboard

Can’t Input Chinese

Open Jiang10086 opened this issue 7 months ago • 2 comments

When I input “wo” in Chinese input mode, normally it will show a panel to let me choose a Chinese character:

Image

Then I can press “1” to input the “我”.

But when I do the same in the fastedit, the panel never shows up so I can’t input any Chinese.

Jiang10086 avatar May 08 '25 16:05 Jiang10086

I am very sorry to hear that. Since the textbox Fastedit uses is written from scratch, it probably does not use this feature. To implement it I would need some kind of API from Microsoft I could build on. But as far as I can tell there is no such API I can use to access the panel in winui3. I am really sorry for this.

FrozenAssassine avatar May 23 '25 09:05 FrozenAssassine

How Windows Messages Trigger the IME Window The Input Method Editor (IME) window in Windows is triggered through a specific messaging mechanism between the system, applications, and the IME itself. Here's a detailed breakdown of the process:

  1. Basics of IME-Application Interaction The IME is implemented as a Dynamic Link Library (DLL) that communicates with applications via the Input Method Manager (IMM32.dll) . When text input is required, the system uses the following messages and APIs to activate the IME window.

  2. Key Messages and Workflow (1) Focus Change Triggers IME WM_SETFOCUS When a control (e.g., a text box) receives focus, Windows sends WM_SETFOCUS. The application then calls ImmAssociateContext to associate an Input Context (HIMC) with the control, signaling that the IME may be needed. (2) IME Activation WM_IME_SETCONTEXT Sent by the system to notify the IME that its context is active (e.g., due to language switching or focus change). If wParam is TRUE, the IME window may appear. (3) IME Window State WM_IME_NOTIFY Used for internal IME notifications, such as: IMN_OPENSTATUSWINDOW – Opens the status window (e.g., language bar). IMN_SETCONVERSIONMODE – Changes input mode (e.g., Chinese/English). (4) Input Request WM_IME_STARTCOMPOSITION Triggered when the user begins typing (e.g., pressing a key). The IME starts composition mode (e.g., displaying Pinyin candidates). The application must handle this to support pre-edit text. (5) Candidate Window Display WM_IME_COMPOSITION Continuously updates as the user types. The lParam flags (GCS_RESULTSTR or GCS_COMPSTR) indicate whether input is complete. The IME dynamically updates the candidate window during this process.

  3. Controlling the IME Window ImmSetOpenStatus Explicitly opens/closes the IME (e.g., when pressing Win+Space to switch languages). ImmSetCandidateWindow Adjusts the candidate window’s position and style, usually based on the current cursor location.

  4. Application Responsibilities Applications must handle these messages to support IME properly:

WM_INPUTLANGCHANGE – Adjusts IME state when the input language changes. WM_CHAR / WM_UNICHAR – Receives finalized input characters. WM_IME_COMPOSITION – Displays pre-edit text in real-time (e.g., grayed-out Pinyin letters). 5. Example Workflow (Pinyin IME) User clicks a text box → WM_SETFOCUS → IME associates with the control. User presses a key → WM_IME_STARTCOMPOSITION → IME shows the composition window. User types "nihao" → WM_IME_COMPOSITION → IME updates candidate words. User selects a candidate → WM_IME_ENDCOMPOSITION → Final text is inserted. 6. Debugging & Verification Use Spy++ to monitor WM_IME_* messages. Check if the IME implements the IMM interface (e.g., ImeSetCompositionString). Through this messaging mechanism, Windows ensures seamless interaction between the IME and applications, triggering the IME window at the right time.

Charltsing avatar Aug 10 '25 02:08 Charltsing