Page 1 of 1

[solved]Vanilla/Editbox no input

Posted: Sun Dec 13, 2009 14:36
by JoseMan
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...

Re: Vanilla/Editbox no input

Posted: Sun Dec 13, 2009 17:17
by CrazyEddie
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.

Re: Vanilla/Editbox no input

Posted: Sun Dec 13, 2009 18:11
by JoseMan
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:

Re: Vanilla/Editbox no input

Posted: Mon Dec 14, 2009 19:44
by CrazyEddie
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.

Re: Vanilla/Editbox no input

Posted: Fri Dec 18, 2009 12:12
by JoseMan
Hi,

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

Thanks and ciao
J...