Page 1 of 1

Setting StaticImage Clicked Handler in XML

Posted: Mon Sep 14, 2009 19:09
by ncoppola
Hi,

I'm currently trying to create a splash page that will advance to the main screen when clicked. I currently have a static image with 2 children, a static text and a button (don't want the button). In the code I was able to use splashimage->subscribeEvent( CEGUI::Window::EventMouseClick, &HandlerFunction) to make the splash go away on a click, but I want to subscribe that in the layout xml instead of the code. I have a lua function that hides the splash and brings up the main page. I tried using <Event Name="Clicked" Function="Splash_Clicked" /> (Splash_Clicked is the Lua function) in the splash image's definition in the layout, but nothing happens when I click on the screen. If I use that same xml line in the definition of the button, clicking the button will call the function.

The static image can obviously do something on a clicked event, because it works in the code. Does this have to do with how the xml is parsed?

Thanks,
Nick

Re: Setting StaticImage Clicked Handler in XML

Posted: Mon Sep 14, 2009 21:00
by CrazyEddie
Hi,

Unfortunately I do not have an answer for you at the moment; another very odd issue :) From a technical standpoint, all window types are treated exactly the same as far as events and xml parsing go. Is there anything in the CEGUI.log file at all that might indicate a problem when you try the subscription to the lua event handler?

CE.

Re: Setting StaticImage Clicked Handler in XML

Posted: Thu Sep 17, 2009 14:17
by ncoppola
Looked through the log file after running it with the subscription in the splash image's definition. There's no error when loading the splash layout file. It logs a success.

Sorry for the late response, this is what happens when you only work twice a week.

Re: Setting StaticImage Clicked Handler in XML

Posted: Thu Sep 17, 2009 19:00
by CrazyEddie
Are there any other windows in the splash layout at all? Perhaps the 'click' is going to the wrong window? If you're uncertain, post the layout and we'll be able to see for sure :)

CE.