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

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
noname
Not too shy to talk
Not too shy to talk
Posts: 21
Joined: Wed Jan 12, 2005 12:06

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

Postby noname » Mon Feb 21, 2005 10:47

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 .

User avatar
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 ?

Postby CrazyEddie » Tue Feb 22, 2005 09:41

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.

User avatar
noname
Not too shy to talk
Not too shy to talk
Posts: 21
Joined: Wed Jan 12, 2005 12:06

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

Postby noname » Wed Feb 23, 2005 00:23

Thanks ,CrazyEddie,I have found it yesterday and trying now.

User avatar
jasom_liu
Just popping in
Just popping in
Posts: 14
Joined: Mon Mar 07, 2005 08:00

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

Postby jasom_liu » Fri Mar 18, 2005 05:41

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:

Guest

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

Postby Guest » Fri Mar 18, 2005 11:52

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

User avatar
olvierwpz
Just popping in
Just popping in
Posts: 8
Joined: Wed Mar 09, 2005 07:06

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

Postby olvierwpz » Tue Apr 05, 2005 13:31

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

User avatar
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 ?

Postby lindquist » Tue Apr 05, 2005 13:44

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!


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 2 guests