Hi ,Crazy Eddie
when I turn on the "Chinese Input Method" ( Ctrl + space/shift),how can I put the Chinese words into EditBox ?
Can the EditBox receive the inputting ?
sorry for my poor English.
Thanks .
Help : how can I put the Chinese words into EditBox ?
Moderators: CEGUI MVP, CEGUI Team
- CrazyEddie
- CEGUI Project Lead
- Posts: 6760
- Joined: Wed Jan 12, 2005 12:06
- Location: England
- Contact:
Re: Help : how can I put the Chinese words into EditBox ?
The library takes UTF-32 codepoints as inputs, so if you can generate these you have no problems, you just use the System::injectChar method to tell the library when a character has been typed.
If you're using some Unicode capable version of Windows, you should ensure your app is set to compile as Unicode and not Ansi, then read up on the WM_UNICHAR notification (since this gives you precisely what you need).
If you do not have (or are not targetting) Unicode capable versions of Windows, then you will need to perform some translation of the WM_CHAR messages from whichever codepage is being used into proper UTF32 codepoint values.
CE.
If you're using some Unicode capable version of Windows, you should ensure your app is set to compile as Unicode and not Ansi, then read up on the WM_UNICHAR notification (since this gives you precisely what you need).
If you do not have (or are not targetting) Unicode capable versions of Windows, then you will need to perform some translation of the WM_CHAR messages from whichever codepage is being used into proper UTF32 codepoint values.
CE.
Re: Help : how can I put the Chinese words into EditBox ?
Thanks ,CrazyEddie,I have found it yesterday and trying now.
Re: Help : how can I put the Chinese words into EditBox ?
I can't change my input method
The main code :
-----------------------------------------------------------
GuiFrameListener(RenderWindow* win, Camera* cam, CEGUI::Renderer* renderer)
: ExampleFrameListener(win, cam, true, true),
mGUIRenderer(renderer),
mShutdownRequested(false)
{
mEventProcessor->addMouseMotionListener(this);
mEventProcessor->addMouseListener(this);
mEventProcessor->addKeyListener(this);
}
void keyPressed(KeyEvent* e)
{
if(e->getKey() == KC_ESCAPE)
{
mShutdownRequested = true;
e->consume();
return;
}
CEGUI::System::getSingleton().injectKeyDown(e->getKey());
CEGUI::System::getSingleton().injectChar(e->getKeyChar());
e->consume();
}
-----------------------------------------------------------
When I press the key "Alt + Tab ",it can change to the other window ,but when I press the "Ctrl"+"Shift" or "Ctrl "+ "Space " ,it does not change the input method
Why?
The main code :
-----------------------------------------------------------
GuiFrameListener(RenderWindow* win, Camera* cam, CEGUI::Renderer* renderer)
: ExampleFrameListener(win, cam, true, true),
mGUIRenderer(renderer),
mShutdownRequested(false)
{
mEventProcessor->addMouseMotionListener(this);
mEventProcessor->addMouseListener(this);
mEventProcessor->addKeyListener(this);
}
void keyPressed(KeyEvent* e)
{
if(e->getKey() == KC_ESCAPE)
{
mShutdownRequested = true;
e->consume();
return;
}
CEGUI::System::getSingleton().injectKeyDown(e->getKey());
CEGUI::System::getSingleton().injectChar(e->getKeyChar());
e->consume();
}
-----------------------------------------------------------
When I press the key "Alt + Tab ",it can change to the other window ,but when I press the "Ctrl"+"Shift" or "Ctrl "+ "Space " ,it does not change the input method
Why?
Re: Help : how can I put the Chinese words into EditBox ?
Your problem comes from Ogre which is unable to give you utf32 codepoints. You could try to have a look at the function "loadResource" in OgreFont.cpp. You'll see that only codepoints between 33 and 167 are loaded, whatever the font you provide. On my system I changed the value from 167 to 255 in order to get 'é' and 'è' glyphs which are very usefull in my language I suppose you have to do some similar changes on yours but to get full utf32 support, you'll also have to change the type used by all related function (from char to a 32bits data type).
--
Chris
--
Chris
Re: Help : how can I put the Chinese words into EditBox ?
noname wrote:
Thanks ,CrazyEddie,I have found it yesterday and trying now.
Can you tell me how to input Chinese in CEGUI.I will appreciate you showing me some codes.Thanks
- lindquist
- CEGUI Team (Retired)
- Posts: 770
- Joined: Mon Jan 24, 2005 21:20
- Location: Copenhagen, Denmark
Re: Help : how can I put the Chinese words into EditBox ?
maybe this is of interest...
SDL has a feature for unicode key translation translation.
I'm using it with injectChar... That way I don't have to worry about modifiers (shift,alt gr) and the keys are translated to my danish keyboard layout.
I have no idea if this works with chinese, or if changing your project to SDL is an option.
But you could check it out... If nothing else just to see if it works!
If it does, I guess you could use the SDL translation code in your own app too!
SDL has a feature for unicode key translation translation.
I'm using it with injectChar... That way I don't have to worry about modifiers (shift,alt gr) and the keys are translated to my danish keyboard layout.
I have no idea if this works with chinese, or if changing your project to SDL is an option.
But you could check it out... If nothing else just to see if it works!
If it does, I guess you could use the SDL translation code in your own app too!
Return to “Modifications / Integrations / Customisations”
Who is online
Users browsing this forum: No registered users and 6 guests