Page 1 of 1

Subscribing an event to a static image

Posted: Wed Mar 16, 2005 23:14
by tawraven
I am having trouble with this and I can't figure out what is wrong. I have an image that i want to use as a button but for some reason, my event function is not being called. Here is my event subscribe code:

Code: Select all

        wmgr.getWindow((CEGUI::utf8*)"ImageOptions")
          ->subscribeEvent(
          CEGUI::StaticImage::EventMouseClick,
          CEGUI::Event::Subscriber(&GuiApplication::handleShowOptions, this));


I set up an Event::Connection variable to check and make sure the event was being registered and it was. There are no errors in the log file. I don't know what else to try.

By the way...CEGUI is awesome.

tawraven

Re: Subscribing an event to a static image

Posted: Thu Mar 17, 2005 05:25
by tawraven
nevermind...i figured it out. i had designed the layout wrong. the static image was a child of the wrong gui sheet. i'm not sure why it make a difference but it works now. :D

before:

Code: Select all

<GUILayout>
<Window Type="DefaultGUISheet" Name="root">
   <Window Type="TaharezLook/StaticImage" Name="Background">
      <Property Name="FrameEnabled" Value="false"/>
   </Window>
   <Window Type="DefaultGUISheet" Name="OgreGuiDemo">
     <Property Name="Size" Value="w:1 h:1" />


after:

Code: Select all

<GUILayout>
<Window Type="DefaultGUISheet" Name="root">
    <Window Type="DefaultGUISheet" Name="OgreGuiDemo">
      <Property Name="Size" Value="w:1 h:1" />
        <Window Type="TaharezLook/StaticImage" Name="Background">
        <Property Name="FrameEnabled" Value="false"/>
        </Window>


tawraven

Re: Subscribing an event to a static image

Posted: Thu Mar 17, 2005 19:29
by CrazyEddie
Just for information, the reason it did not work before is because the other gui sheet was appearing, full screen, over the top of the StaticImage, and as such no inputs were reaching the StaticImage since no matter where the mouse was it was aways in the second sibling gui sheet.

CE.