Page 1 of 1

sheet / root window events

Posted: Mon Jul 11, 2005 19:08
by kristian
Hello,
How can i determine if the sheet is clicked, i want to enable "game input" when i click the sheet root window and disable the "game input" when i click and other window.

How is that accomplished or is that possible at all ?

all myy attempts of doing this seems to have failed becourse the mouse click event for the root window is seems to be called even if i dont click the root window.

- Kristian

Re: sheet / root window events

Posted: Tue Jul 12, 2005 17:23
by Acrion
Have you tried EventActivated and EventDeactivated on either all of your widgets or the (doubt it would work as your widgets are children) root sheet?

I never tried MouseClicked but MouseButtonDown and MouseButtonUp work properly on the root for me as of 0.3.0.

Another thing that might be effective is doing something similar to XMouse using MouseEnters/MouseLeaves on your widgets. IE: when you move the mouse over a FrameWindow, your input switches to the form, when it goes over the GUISheet, your input goes to the game.

Hope this helps.

Re: sheet / root window events

Posted: Wed Jul 13, 2005 07:53
by kristian
this is the solution i came up with:

bool GuiEventHandler::_onSheet_MouseClick( const CEGUI::EventArgs& e ) {
CEGUI::Window* c = mGuiSystem->getGUISheet()->getChildAtPosition(((const CEGUI::MouseEventArgs&)e).position);
if( c != 0 ) {
mInputMode = 0;
false;
} else {
mInputMode = 1;
if( mGuiSystem->getGUISheet()->getActiveChild() )
mGuiSystem->getGUISheet()->getActiveChild()->deactivate();
((CEGUI::EventArgs&)e).handled = true;
}
return e.handled;
}