Some questions, CEGUI 0.2.0

For help with anything that CEGUI doesn't offer straight out-of-the-box, e.g.:
- Implementation of new features, such as new Core classes, widgets, WindowRenderers, etc. ...
- Modification of any existing features for specific purposes
- Integration of CEGUI in new engines or frameworks and writing of new plugins (Renderer, Parser, ...) or modules

Moderators: CEGUI MVP, CEGUI Team

User avatar
Nocs
Just popping in
Just popping in
Posts: 7
Joined: Fri Mar 04, 2005 21:05

Some questions, CEGUI 0.2.0

Postby Nocs » Mon Mar 14, 2005 17:54

1st question)
How can i register a EventKeyDown to a Editbox?
i have tried with

Code: Select all

bool handleSendButtonKey(const CEGUI::KeyEventArgs& e)
{
 .....
}

....

CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();

wmgr.getWindow("client_lobby\\chat\\editbox")
      ->subscribeEvent(
      CEGUI::Window::EventKeyDown,
      CEGUI::Event::Subscriber(&handleSendButtonKey));

but it gives me a compiling error.

2nd question)
How can i redirect all the inputs to a FrameWindow so that all the other widgets cant become inputs for the time the FrameWindow is active (like ShowModal() in delphi)??

Thanks

User avatar
rincewind
Just popping in
Just popping in
Posts: 14
Joined: Wed Jan 12, 2005 12:06

Re: Some questions, CEGUI 0.2.0

Postby rincewind » Mon Mar 14, 2005 21:37

for your second question, this is the code I use to make a framewindow modal:

Code: Select all

bool keepActivated(const CEGUI::EventArgs & e)
{
   ((CEGUI::WindowEventArgs*)&e)->window->activate();
   return true;
}

//on initialization:
myFramewindow->subscribeEvent(
   CEGUI::Window::EventDeactivated,
   CEGUI::Event::Subscriber(&keepActivated));


Beware though that if you do that with two windows at the same time, you end up gettting stuck in an infinite loop. So always guard the connection object for the subscription and unsubscribe from it. You might want to encapsulate this somehow, so it's more or lesss guaranteed that only one window is modal at a time.

Greetings,

Rincewind

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Some questions, CEGUI 0.2.0

Postby CrazyEddie » Tue Mar 15, 2005 09:23

The signature for the event handler is incorrect. It takes a const EventArgs&, once in the function you can cast to whatever the 'real' type is.

HTH

CE.

User avatar
Nocs
Just popping in
Just popping in
Posts: 7
Joined: Fri Mar 04, 2005 21:05

Re: Some questions, CEGUI 0.2.0

Postby Nocs » Tue Mar 15, 2005 17:22

Thanks for te reply CE.
Is there a flexibler way (for example function call of FrameWindow) to show a FrameWindow Modal than the suggestion of rincewind?

User avatar
CrazyEddie
CEGUI Project Lead
Posts: 6760
Joined: Wed Jan 12, 2005 12:06
Location: England
Contact:

Re: Some questions, CEGUI 0.2.0

Postby CrazyEddie » Tue Mar 15, 2005 19:36

There's nothing currently built-in to provide this functionality. I will likely add a set of 'higher level' utility classes which will achieve this kind of thing, though unfortunately this kind of thing is not on the radar at the moment.

So for the time being you need to implement this yourself, the suggestion made by rincewind is certainly valid. You might be able to do something via the captureInputs call, though there are various pitfalls here too, so you'd need to monitor when you 'lose' the catpure and re-aquire it. You'd also need to ensure that inputs were forwarded from the root capture window to child windows. These suggestions are still not the 'only' ways of doing this, I do understand that all of these solutions seem a bit 'hackish'.

CE.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 11 guests