[SOLVED] Space bar not adding spaces in an editbox.

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

Zodiaclawl
Just popping in
Just popping in
Posts: 6
Joined: Tue Feb 25, 2014 02:11

[SOLVED] Space bar not adding spaces in an editbox.

Postby Zodiaclawl » Sat Mar 01, 2014 03:28

Hello. Thanks for all the help a few days ago to compile CEGUI. I've started to integrate it with Irrlicht and I've come a long way. But I have a small problem now. I'm using the sample layout called VanillaConsole.layout and I'm trying to implement the features now. The problem I'm having is that I can't put spaces in the edit box of the console layout. I can write just fine, and I can use backspace to delete text, but spaces don't work.

Like so:
Image

I have checked the key injections to see if there's a problem. Since I'm using Irrlicht I have to convert some of the key codes to CEGUI::Key::Scan codes. But I'm pretty sure I haven't done anything wrong.

Code: Select all

bool PEventReceiver::injectSpecialKeysToCEGUI(wchar_t key)
{

   switch(key)
   {

   case KEY_BACK:
      {
         CEGUISystem->getDefaultGUIContext().injectKeyDown(CEGUI::Key::Scan::Backspace); //This code makes it possible to delete the text. If I comment it out I can't delete the text.
         return true;
      }

   case KEY_SPACE:
      {
         printf("This code gets executed.\n"); //This gets printed in the console. So CEGUI::Key::Scan::Space gets injected into CEGUI.
         CEGUISystem->getDefaultGUIContext().injectKeyDown(CEGUI::Key::Scan::Space);
         return true;
      }

   default:
      return false;

   }

}


Is there something I need to do to be able to write spaces in the text box? I'm sorry for pestering you with questions, but I don't really understand how this works yet.

Thanks in advance.

User avatar
Ident
CEGUI Team
Posts: 1998
Joined: Sat Oct 31, 2009 13:57
Location: Austria

Re: Space bar not adding spaces in an editbox.

Postby Ident » Sat Mar 01, 2014 06:28

Are you also doing injectChar(...) ?
CrazyEddie: "I don't like GUIs"

Zodiaclawl
Just popping in
Just popping in
Posts: 6
Joined: Tue Feb 25, 2014 02:11

Re: Space bar not adding spaces in an editbox.

Postby Zodiaclawl » Sat Mar 01, 2014 13:34

Ident wrote:Are you also doing injectChar(...) ?

Oh my god I'm stupid...

Code: Select all

   case KEY_SPACE:
      {
         CEGUISystem->getDefaultGUIContext().injectKeyDown(CEGUI::Key::Scan::Space);
         CEGUISystem->getDefaultGUIContext().injectChar(' ');
         return true;
      }


This fixed it :P


Return to “Help”

Who is online

Users browsing this forum: No registered users and 8 guests