[solved] Numeric keyboard in EditBoxes

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

djphilipe
Quite a regular
Quite a regular
Posts: 48
Joined: Thu Aug 23, 2007 10:15
Location: Slovakia
Contact:

[solved] Numeric keyboard in EditBoxes

Postby djphilipe » Fri Oct 30, 2009 13:43

Hi,
why don't work numeric keyboard in editboxes?
I want input num characters, but it doesn't work.
How I can write with num keyboard?

Thanks very much
Filip

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: Numeric keyboard in EditBoxes

Postby Jamarr » Fri Oct 30, 2009 19:39

did you turn on Num Lock on your keyboard?
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!

djphilipe
Quite a regular
Quite a regular
Posts: 48
Joined: Thu Aug 23, 2007 10:15
Location: Slovakia
Contact:

Re: Numeric keyboard in EditBoxes

Postby djphilipe » Mon Nov 02, 2009 07:14

Do you think I'm stupid? :)

djphilipe
Quite a regular
Quite a regular
Posts: 48
Joined: Thu Aug 23, 2007 10:15
Location: Slovakia
Contact:

Re: Numeric keyboard in EditBoxes

Postby djphilipe » Mon Nov 02, 2009 08:50

The problem is in OIS. If I press for example key '5' on numeric keyboard OIS return keyEvent.text=0. I had to set text hard.

Code: Select all

bool GIKeyboardListener::keyReleased(const OIS::KeyEvent &arg)
{
 unsigned int text = arg.text;
   
   switch (arg.key) {
      case OIS::KC_NUMPAD0: text = '0'; break;
      case OIS::KC_NUMPAD1: text = '1'; break;
      case OIS::KC_NUMPAD2: text = '2'; break;
      case OIS::KC_NUMPAD3: text = '3'; break;
      case OIS::KC_NUMPAD4: text = '4'; break;
      case OIS::KC_NUMPAD5: text = '5'; break;
      case OIS::KC_NUMPAD6: text = '6'; break;
      case OIS::KC_NUMPAD7: text = '7'; break;
      case OIS::KC_NUMPAD8: text = '8'; break;
      case OIS::KC_NUMPAD9: text = '9'; break;
      case OIS::KC_DECIMAL: text = '.'; break;
   }
     return   m_pGUISystem->injectKeyDown( arg.key ) || m_pGUISystem->injectChar( text );
}

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Re: Numeric keyboard in EditBoxes

Postby Jamarr » Mon Nov 02, 2009 19:31

djphilipe wrote:Do you think I'm stupid? :)


lol! Sorry I just couldn't resist. :wink: I'm glad you got it worked out.

As the Injecting Inputs tutorial mentions, how you obtain the UTF32 value to inject is something that is dependant upon the input library and so is up to you to figure out.

Thanks for posting your solution, I'm sure it will be of use to others using OIS.
If somebody helps you by replying to your thread, upvote him/her as a thanks! Make sure to include your CEGUI.log and everything you tried when posting! And remember that we are not magicians!


Return to “Help”

Who is online

Users browsing this forum: No registered users and 5 guests