Subscribing an event to a static image

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
tawraven
Just popping in
Just popping in
Posts: 6
Joined: Wed Mar 16, 2005 22:55

Subscribing an event to a static image

Postby tawraven » Wed Mar 16, 2005 23:14

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

User avatar
tawraven
Just popping in
Just popping in
Posts: 6
Joined: Wed Mar 16, 2005 22:55

Re: Subscribing an event to a static image

Postby tawraven » Thu Mar 17, 2005 05:25

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

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

Re: Subscribing an event to a static image

Postby CrazyEddie » Thu Mar 17, 2005 19:29

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.


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 19 guests