Page 1 of 1

Editbox and EventTextAccepted

Posted: Tue May 07, 2019 20:06
by Crazy Eddie Jr
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?

Re: Editbox and EventTextAccepted

Posted: Tue May 07, 2019 20:21
by Ident
What do you mean by "return"? Do you mean the enter key?

Re: Editbox and EventTextAccepted

Posted: Tue May 07, 2019 21:07
by Crazy Eddie Jr
Enter key, yes.

Re: Editbox and EventTextAccepted

Posted: Wed May 08, 2019 06:37
by Ident
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.

Re: Editbox and EventTextAccepted

Posted: Wed May 08, 2019 13:37
by Crazy Eddie Jr
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);
}

Re: Editbox and EventTextAccepted

Posted: Wed May 08, 2019 18:46
by Ident
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 :(

Re: Editbox and EventTextAccepted

Posted: Wed May 08, 2019 21:21
by Crazy Eddie Jr
My bad; what I thought was a Editbox was a MultiLineEditbox.
Works now.