Page 1 of 1

Help : how can I put the Chinese words into EditBox ?

Posted: Mon Feb 21, 2005 10:47
by noname
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 .

Re: Help : how can I put the Chinese words into EditBox ?

Posted: Tue Feb 22, 2005 09:41
by CrazyEddie
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.

Re: Help : how can I put the Chinese words into EditBox ?

Posted: Wed Feb 23, 2005 00:23
by noname
Thanks ,CrazyEddie,I have found it yesterday and trying now.

Re: Help : how can I put the Chinese words into EditBox ?

Posted: Fri Mar 18, 2005 05:41
by jasom_liu
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? :cry:

Re: Help : how can I put the Chinese words into EditBox ?

Posted: Fri Mar 18, 2005 11:52
by Guest
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

Re: Help : how can I put the Chinese words into EditBox ?

Posted: Tue Apr 05, 2005 13:31
by olvierwpz
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

Re: Help : how can I put the Chinese words into EditBox ?

Posted: Tue Apr 05, 2005 13:44
by lindquist
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!