Editbox and EventTextAccepted

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

Crazy Eddie Jr
Just popping in
Just popping in
Posts: 4
Joined: Tue May 07, 2019 19:37

Editbox and EventTextAccepted

Postby Crazy Eddie Jr » Tue May 07, 2019 20:06

Hello,

I have a Editbox set up so you can type into it / edit the text. The thing is the Event Subscriber to EventTextAccepted never gets called when return is pressed; It just goes to a new line in the editbox.

Code: Select all

editbox->subscribeEvent
      (CEGUI::Editbox::EventTextAccepted ,
      CEGUI::Event::Subscriber(&Console::returnSubscribe,this));


What does it take to get the Editbox to return?

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

Re: Editbox and EventTextAccepted

Postby Ident » Tue May 07, 2019 20:21

What do you mean by "return"? Do you mean the enter key?
CrazyEddie: "I don't like GUIs"

Crazy Eddie Jr
Just popping in
Just popping in
Posts: 4
Joined: Tue May 07, 2019 19:37

Re: Editbox and EventTextAccepted

Postby Crazy Eddie Jr » Tue May 07, 2019 21:07

Enter key, yes.

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

Re: Editbox and EventTextAccepted

Postby Ident » Wed May 08, 2019 06:37

Works in 0.8.X sample browser. I just tested it. The code path also processes the enter/return key.

You told us nothing about your setup, but since it work in the sample browser the issue must be in your code, where you inject inputs into CEGUI.
CrazyEddie: "I don't like GUIs"

Crazy Eddie Jr
Just popping in
Just popping in
Posts: 4
Joined: Tue May 07, 2019 19:37

Re: Editbox and EventTextAccepted

Postby Crazy Eddie Jr » Wed May 08, 2019 13:37

I am using OIS 'keyPressed' and 'keyReleased' to call two functions:

Code: Select all

void InjectKeyDown(CEGUI::Key::Scan x, unsigned int y){
   CEGUI::System::getSingleton().getDefaultGUIContext().injectKeyDown(x);
   CEGUI::System::getSingleton().getDefaultGUIContext().injectChar(y);
}

void InjectKeyUp(CEGUI::Key::Scan x, unsigned int y){
   CEGUI::System::getSingleton().getDefaultGUIContext().injectKeyUp(x);
}

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

Re: Editbox and EventTextAccepted

Postby Ident » Wed May 08, 2019 18:46

Step through the code to see why the event is not fired. I can't reproduce it on default branch. Didn't test anything else than default since you gave no info :(
CrazyEddie: "I don't like GUIs"

Crazy Eddie Jr
Just popping in
Just popping in
Posts: 4
Joined: Tue May 07, 2019 19:37

Re: Editbox and EventTextAccepted

Postby Crazy Eddie Jr » Wed May 08, 2019 21:21

My bad; what I thought was a Editbox was a MultiLineEditbox.
Works now.


Return to “Help”

Who is online

Users browsing this forum: No registered users and 14 guests