I used my single-line text box control C #. Created in 3.5
I have written it completely with your scratch, including your own selection code, scrolling, copy / paste etc. It can also choose from left to right text, not that I will ever use it ...
The problem is with IME (input method editor) integration. I IME works to an extent , But I have some problems. I'll just list one of them here.
Normally, using the text box, the IME is presented inside the build textbox, however, under my control, the IME is displayed on the bottom right of the screen. I tried to see other custom controls, used in SharpDevelop in it, however, it was the same problem, because of typing in Chinese, Japanese or Korean IME stuff can be done on the lower right part of the screen.
I need some points on how to do this in my own text box, and I looked at the Windows API for IME, but there are lots of functions, and I do not know where to start from is.
So, any thoughts?
This is fine if any code sample is C ++ (managed / unmanaged) or VB.net, I can easily move it across.
OK, it seems that there are not many IME experts StackOverflow ... or any other interested is not.
Still, I thought it.
Actually, I have to trap the following Windows messages:
WM_INPUTLANGCHANGE = 0x51 WM_KEYUP = 0x101 WM_CHAR = 0x102 WM_CONVERTREQUESTEX = 0x108 WM_IME_STARTCOMPOSITION = 0x10D WM_IME_ENDCOMPOSITION = 0x10E WM_IME_COMPOSITION = 0x10F WM_IME_SETCONTEXT = 0x281 WM_IME_NOTIFY = 0x282 WM_IME_CONTROL = 0x283 WM_IME_COMPOSITIONFULL = 0x284 WM_IME_SELECT = 0x285 WM_IME_CHAR = 0x286 WM_IME_REQUEST = 0x0288 WM_IME_KEYDOWN = 0x290 WM_IME_KEYUP = 0x291 I WM_KEYUP and WM_CHAR is stuck, because if I click somewhere between a Korean character combination, then I do not get a composition message, however Me that characters need to add my text box is a strange behavior, I wonder if it is a bug.
When this happens, there are different behaviors between Korean, Chinese and Japanese.
Korean is a lot easier (I'm not sure how to convert Hanja though, because I do not know how to use it).
Actually, for all languages, whenever I get WM_IME_COMPOSITION , call me for ImmGetCompositionString in Imm32.dll as I have described the answer. I then display it in progress as a structure, but do not add it to my archived text.
When a string is composoded, the message from Windows is different for each IME. Every time, I can get it from the WM_IME_COMPOSITION message.
In Korean, LParam should be GCS_RESULTSTR , and the WPARM will be the letter entered, which I just call Char
will place in 'Japanese' LPARM GCS_RESULTREADSTR | GCS_RESULTREADCLAUSE | GCS_RESULTSTR0 | GCS_RESULTCLAUSE . I want to use the result of ImmGetCompositionString , which I have stored with the last WM_IME_COMPOSITION message, because at the moment it will be an empty string.
Sugar will be LParam GCS_RESULTREADCLAUSE | GCS_RESULTSTR0 | GCS_RESULTCLAUSE . It is similar to Japanese pre-stored ImmGetCompositionString , in which case I need to insert WPAR in any form.
In all three cases, I have to ensure that my performance is in progress in progress.
If I get the WM_IME_STARTcompositive , then I set a compositing flag (and display the computing string in progress)
if I WM_IME_ENDCOMPOSITION is received I clear that flag (and the compositing string in progress).
Sometimes I do not receive WM_IME_ENDCOMPOSITION , so I clear my flag when I received the code
In everything, this was a very interesting learning experience, and still in progress - but the IME is now usable for my control, in the end! I stayed till 1:00 to work.
Comments
Post a Comment