Key input to static text

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

PapiRauk
Just popping in
Just popping in
Posts: 3
Joined: Thu Sep 14, 2006 12:21

Key input to static text

Postby PapiRauk » Thu Sep 21, 2006 21:23

Hi!
I'm using Ogre input with CEGUI and have created a statictext window to use as my debug/input window. It scrolls down from the top.

My problem is: how do i input the char for the key i pressed through the function that is called by the event? As it is now, i simply get the char from KeyEvent and do a statictext->settext.
i've been trying all kinds of functions but cant get the input to display. The function called by the event is called so it gets that far but is statictext missing the functionality for adding characters automaticaly or am i missing something?

Been at this for many hours now and need some help getting my facts straight.

heres my code anyway:

Code: Select all

// Get pointer to debug window
   mTextWindow = (CEGUI::StaticText*)CEGUI::WindowManager::getSingleton().getWindow( (CEGUI::utf8*)"text" );
   // Subscribe to event
   mTextWindow->subscribeEvent( CEGUI::StaticText::EventKeyDown, CEGUI::Event::Subscriber( &PlayState::setDebugKey, this ) );


This is what i'm doing now

Code: Select all

// Check if debug window is down
   if( !mDebugUp && mTextWindow->getPosition().d_y >= 0.0 )
   {
      CEGUI::String mystr;   
      mystr += e->getKeyChar();
                               // Simple setText() function
      setDebugText( mystr, false );


      mTextWindow->activate();
      mGUISystem->injectKeyDown( e->getKey() );
      mGUISystem->injectChar( e->getKeyChar() );
      e->consume();
   }


BTW, I'm having serious problems accessing all CEGUI homepages. The rest of the web is no prob, just CEGUI. Thought you'd like to know.
It's hip to be square, it's hipper to be a triangle..

PapiRauk
Just popping in
Just popping in
Posts: 3
Joined: Thu Sep 14, 2006 12:21

Postby PapiRauk » Thu Sep 21, 2006 22:36

Think i found my answer. Isn't it typical that i find it right after i post here?
Well for all of you who find this post instead of what your looking for, I give u this link:
http://www.cegui.org.uk/phpBB2/viewtopic.php?t=1292&highlight=key+scan

Make sure to check out ceguiinputevent.h you can find it in both ogre and CEGUI.
It's hip to be square, it's hipper to be a triangle..


Return to “Help”

Who is online

Users browsing this forum: No registered users and 32 guests