Page 1 of 1

Image Buttons

Posted: Wed Oct 10, 2007 20:31
by E.Kiver
I've read "Create ImageButtons" article http://www.cegui.org.uk/wiki/index.php/ ... ageButtons
but I cannot access source files because of invalid link.
So my question is: How to subscribe event to ImageButton?
this is part of my GUI.layout
<Window Type="DefaultGUISheet" Name="root">
<Window Type="DefaultGUISheet" Name="GameGUI">
<Property Name="UnifiedSize" Value="{{1,0},{1,0}}" />

<Window Type="TaharezLook/ImageButton" Name="GameGui/btnNewGame">

and in my programm I call

CEGUI::WindowManager& wmgr = CEGUI::WindowManager::getSingleton();
wmgr.getWindow((CEGUI::utf8*)"GameGUI/btnNewGame")
->subscribeEvent(
CEGUI::PushButton::EventClicked,
CEGUI::Event::Subscriber(&IntroState::GUIQuitGame, this));

and then I get an exception(without subscribing I see my button and it is also reacts on dragover and such events). I guess it is caused by

CEGUI::PushButton::EventClicked

maybe I'm wrong but my button is ImageButton rather than Button so I cannot use PushButton class of CEGUI

Once again, how to subscribe event to ImageButton?

Reply

Posted: Wed Oct 10, 2007 21:08
by E.Kiver
I’ve solve it. Was reading TaharezLookSkin.scheme for ImageButton and figured that it IS PushButton but with different graphical representation. So I’ve checked my Layout angain and noticed that my button was declared as GameGui\btnNewGame and in the game I was trying to reach GameGUI\btnNewGame.
Sorry for nonsence post.

Posted: Mon Oct 22, 2007 10:44
by Pompei2
Your post has sense, now i know that the links are broken ....... shit :)
And to detect such bugs, you should enclose EVERY block that calls cegui functions with a try/catch mechanism, as such "crashs" will happen often to you ! also always look into CEGUI.log, often there is something to help you.