How to deal input with EditBox or MultiLineEditBox that indi

Forum for general chit-chat or off-topic discussion.

Moderators: CEGUI MVP, CEGUI Team

User avatar
jingjie
Just popping in
Just popping in
Posts: 3
Joined: Mon Oct 03, 2005 03:18

How to deal input with EditBox or MultiLineEditBox that indi

Postby jingjie » Thu Oct 06, 2005 06:32

I try to let EditBox or MultiEditBox support to indicate Unicode character. :P But I don't handle MS-IME Messages
like WM_IME_COMPOSITION,WM_IME_ENDCOMPOSITION etc.
If someone interests it , you can do it like directx9.0c IME-EditBox, it's very cool.
Currently It's working to to indicate Unicode character,but Some Source code and data files have to be modified.
For Chinese character example.
1. Copy Tradition Chinese Font(I use 細明體(mingliu.ttc)) for ./datafiles/fonts/

2.Construct mingliu.font in ./datafiles/fonts/
and define its GlyphRange;
because I use Tradition Chinese Sub CodePoint (19968~40868 )
its' content:
<?xml version="1.0" ?>
<Font Name="mingliu" Filename="../datafiles/fonts/mingliu.ttc" Type="Dynamic" Size="12" NativeHorzRes="800" NativeVertRes="600" AutoScaled="true">
<GlyphRange StartCodepoint="19968" EndCodepoint="40868" />
</Font>

3. Add mingliu.font Setting into ./datafiles/fonts/schemes/TaharezLook.scheme
<?xml version="1.0" ?>
<GUIScheme Name="TaharezLook">
<Imageset Name="TaharezLook" Filename="../datafiles/imagesets/TaharezLook.imageset" />
<Font Name="mingliu" Filename="../datafiles/fonts/mingliu.font" />
<WindowSet Filename="CEGUITaharezLook" />
</GUIScheme>

4.Modified Sample_Demo7.cpp::initialiseSample()

System::getSingleton().setDefaultFont((CEGUI::utf8*)"mingliu" );

CEGUI::Font* font = CEGUI::FontManager::getSingleton().getFont((CEGUI::utf8*)"mingliu" );
font->setAutoScalingEnabled(true);
font->setNativeResolution(Size(800, 600));
font->defineFontGlyphs(font->getAvailableGlyphs());

5.Modified Win32AppHelper.cpp
(a)add this include and inline funciotn
#include <ctype.h>
inline int __cdecl isLeadByte(int _C)
{return ((unsigned char)(_C) & 0x80); }
(b)Modified wndProc()::case WM_CHAR to deal with Multi-Bye into Unicode then injectChar() is working well;

case WM_CHAR: {
static char MultiByte[2]={0};
static bool isHaveMultiByte = false;
if (isHaveMultiByte) {
isHaveMultiByte = false;
MultiByte[1] = (unsigned char) wParam;
int iLengthUnicode = 0;
wchar_t szUnicode;
MultiByteToWideChar(CP_ACP, 0, (char*)MultiByte, 2, &szUnicode, 1);
CEGUI::System::getSingleton().injectChar((CEGUI::utf32)szUnicode);
break;
}
else
{
if(isLeadByte(wParam))
{
isHaveMultiByte = true;
MultiByte[0] = (unsigned char)wParam;
}else
{
CEGUI::System::getSingleton().injectChar((CEGUI::utf32)wParam);
break;
}
}
}
[size=large]Screen Shot:[/size]
[img align=left]http://webhd.yam.com/jingjie//cegui1.JPG[/img]

User avatar
snos
Just popping in
Just popping in
Posts: 4
Joined: Sun Oct 09, 2005 06:46

Re: How to deal input with EditBox or MultiLineEditBox that

Postby snos » Sun Oct 09, 2005 06:59

hi, I have tried this way,but when loadScheme,something gone wrong,I trace that error occurs when loading font resource ,can you give me some advice? :shock:

chybin
Just popping in
Just popping in
Posts: 8
Joined: Fri Jun 02, 2006 10:20
Contact:

Exception

Postby chybin » Mon Jun 19, 2006 07:09

To jingjie:

I do as you write,the Exception occur:
Font::defineFontGlyphs_impl - operation requires a texture larger than the supported maximum.

turbonabi
Just popping in
Just popping in
Posts: 2
Joined: Mon Jul 31, 2006 20:39
Contact:

Re: How to deal input with EditBox or MultiLineEditBox that

Postby turbonabi » Thu Aug 03, 2006 15:16

jingjie wrote:4.Modified Sample_Demo7.cpp::initialiseSample()

5.Modified Win32AppHelper.cpp
(a)add this include and inline funciotn
#include <ctype.h>
inline int __cdecl isLeadByte(int _C)
{return ((unsigned char)(_C) & 0x80); }
(b)Modified wndProc()::case WM_CHAR to deal with Multi-Bye into Unicode then injectChar() is working well;


Where would I find these files??? or something equivalent to these...
Can't figure out where to put those code. I am using OGRE 1.2.2 SDK for Visual C++ .Net 2005 (8.0)

Thank you


Return to “Offtopic Discussion”

Who is online

Users browsing this forum: No registered users and 5 guests