[solved]Vanilla/Editbox no input

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

JoseMan
Just popping in
Just popping in
Posts: 15
Joined: Sun Nov 08, 2009 08:38

[solved]Vanilla/Editbox no input

Postby JoseMan » Sun Dec 13, 2009 14:36

Hi at all,

I've got a problem:
I create an EditBox where a player can type his name.
But when I click in this widget a blue cursor appears but I can't do a input.
Here is the code how I create the EditBox:

Code: Select all

Window* editName = WindowManager::getSingleton().createWindow("Vanilla/Editbox","Name_Edit");
editName->setPosition(UVector2(cegui_reldim(0.45), cegui_reldim( 0.3)));
editName->setSize(UVector2(cegui_reldim(0.50f), cegui_reldim( 0.1)));
editName->setProperty("MaxTextLength","50");
editName->setProperty("ReadOnly","False");
frame->addChildWindow(editName);


What I have to do to get this work?
Thanks for reply.

Ciao J...
Last edited by JoseMan on Fri Dec 18, 2009 12:12, edited 1 time in total.

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Vanilla/Editbox no input

Postby CrazyEddie » Sun Dec 13, 2009 17:17

Hi,

I considered ignoring your post completely; you haven't posted any relevant information.

There are three likely scenarios:
1) You're not injecting characters into the system, hence no text input.
2) The font you're using does not contain glyphs for the characters you're typing.
3) You're using 0.7.1, have subscribed Window::EventCharacterKey and are returning true from the handler (thus marking the event handled, preventing the character being added).

HTH

CE.

JoseMan
Just popping in
Just popping in
Posts: 15
Joined: Sun Nov 08, 2009 08:38

Re: Vanilla/Editbox no input

Postby JoseMan » Sun Dec 13, 2009 18:11

CrazyEddie wrote:Hi,

I considered ignoring your post completely; you haven't posted any relevant information.

Sorry, but what informations do you need? The version I use is 0.7.1.

CrazyEddie wrote:3) You're using 0.7.1, have subscribed Window::EventCharacterKey and are returning true from the handler (thus marking the event handled, preventing the character being added).

Okay, thanks. That was the problem.
But:
One more question:
When I press "back" to erease some characters nothing hapen.
Cause I inject only "text" on the OIS::KeyListener:::keyPressed-methode.
I can inject key codes, but I don't know how I get the key code in my gui.
Is there a easy way to solve this problem?

Ciao J..

P.s: Sorry for my bad english :oops:

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Vanilla/Editbox no input

Postby CrazyEddie » Mon Dec 14, 2009 19:44

The kind of info we need is indicated in the posting Forum Usage Guidelines: Ensure you have read this! - mainly it's the log file we're interested in, and usually only a specific section of it, because this tells us lots of things about the CEGUI set up you have and saves us form making incorrect assumptions.

To answer the OIS / key related question, I point to the samples framework code for the same:

Code: Select all

bool CEGuiDemoFrameListener::keyPressed(const OIS::KeyEvent &e)
{
    // give 'quitting' priority
    if (e.key == OIS::KC_ESCAPE)
    {
        d_quit = true;
         return true;
    }

    // do event injection
    CEGUI::System& cegui = CEGUI::System::getSingleton();

    // key down
    cegui.injectKeyDown(e.key);

    // now character
    cegui.injectChar(e.text);


    return true;
}


Don't forget to inject key 'up' events also (though also note there is no 'up' injection for Chars, just the key codes).

CE.

JoseMan
Just popping in
Just popping in
Posts: 15
Joined: Sun Nov 08, 2009 08:38

Re: Vanilla/Editbox no input

Postby JoseMan » Fri Dec 18, 2009 12:12

Hi,

yes thank you, that was the solution.
Now it works fine.. :) ..

Thanks and ciao
J...


Return to “Help”

Who is online

Users browsing this forum: No registered users and 24 guests