Double click event crashes CEGUI

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

Evenstar
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Tue Feb 28, 2006 23:14

Double click event crashes CEGUI

Postby Evenstar » Mon Apr 10, 2006 22:23

Hi,

I've created a simple GUI that contains a static image with a transparent background titlebar in XML. I've subscribed the staticimage with the CEGUI::Window::EventMouseDoubleClick event. However, every time I double click the static image, the application crashes here:

Code: Select all

void FrameWindow::toggleRollup(void)
{
    if (isRollupEnabled())
    {
        d_rolledup ^= true;
       
        // event notification.
        WindowEventArgs args(this);
        onRollupToggled(args);
    }

}


The onRollupToggled function is corrupt (i.e. NULL) for some reason. In other words, stepping into onRollupTogged causes the Instruction Pointer to point to 0000:0000.

Thanks for any help,
Brian

P.S. my XML code is:

Code: Select all

<?xml version="1.0" ?>
<GUILayout>
    <Window Type="DefaultWindow" Name="root">
   
        <Window Type="WindowsLook/StaticImage" Name="CADETControlWnd" >
            <Property Name="Image" Value="set:CADETImageset image:Background" />
            <Property Name="BackgroundEnabled" Value="False" />
            <Property Name="FrameEnabled" Value="False" />
            <Property Name="RollupEnabled" Value="False" />


<!-- Change these properties to modify the dimensions of the CADET Static window -->
            <Property Name="AbsoluteRect" Value="l:0.0 t:0.0 r:640.0 b:331.25" />
<!--
            <Property Name="AbsoluteRect" Value="l:0.0 t:0.0 r:320.0 b:165.625" />
-->           
           
            <Window Type="WindowsLook/FrameBkgnd" Name="CADETControlBkgnd">
                <Property Name="Visible" Value="true" />
                <Property Name="RelativeRect" Value="l:0.0 t:0.0 r:1.0 b:1.0" />
                <Property Name="RollupEnabled" Value="False" />
            </Window>
           
            <Window Type="WindowsLook/StaticImage" Name="TFCWnd" >
                <Property Name="RollupEnabled" Value="false" />
                <Property Name="Image" Value="set:CADETImageset image:TFC" />
                <Property Name="BackgroundEnabled" Value="False" />
                <Property Name="FrameEnabled" Value="False" />
                <Property Name="RelativeRect" Value="l:0.867188 t:0.264151 r:0.918945 b:0.367925" />
            </Window>
        </Window>           
    </Window>
</GUILayout>

User avatar
martignasse
Just can't stay away
Just can't stay away
Posts: 227
Joined: Thu Apr 14, 2005 08:10
Location: Lyon, FRANCE

Postby martignasse » Tue Apr 11, 2006 07:49

hi,

you use StaticImage, but you try to put in a property(RollupEnabled) that StaticImage hasn't, it's a FrameWindow property.

look in the API Reference.

Evenstar
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Tue Feb 28, 2006 23:14

Postby Evenstar » Tue Apr 11, 2006 14:48

martignasse wrote:hi,

you use StaticImage, but you try to put in a property(RollupEnabled) that StaticImage hasn't, it's a FrameWindow property.

look in the API Reference.


Thanks. This doesn't solve my problem, and it was actually a test on my part that I forgot to take out of my code. You see, when the application crashes, the "this" pointer points to a class whose WidgetTypeName is "Falagard/StaticImage". Rollup is enabled, so the check for "if (isRollupEnabled())" is always true. At this point, onRollupToggled is already NULL. The reason I had put the property in the XML code in the first place was to try and prevent the crash from occuring because the conditional statement would evaluate to False.

I really wish your answer was the answer I needed, but unfortunately it wasn't.

Any other ideas? Personally, if I were a betting man, I'd bet it is a memory overwrite. Where that would be happening I do not know.

Thanks,
Brian

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Postby lindquist » Tue Apr 11, 2006 15:24

rollup enabled is really just the FrameWindow.no other widgets have that method or property.

you should never end up in then FrameWindow code for anything but a FrameWindow.

something is definitely messed up.

[edit]WindowsLook/FrameBkgnd is'nt default, maybe you invalidated the XML while adding it, and TinyXML is'nt catching it. You could try using the XercesParser for validation.
Not sure it helps but it seems worth a try (unless it's just an alias)[/edit]

Evenstar
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Tue Feb 28, 2006 23:14

Postby Evenstar » Tue Apr 11, 2006 16:57

Speaking of FrameBkgnd, that is a new looknfeel that I added. I'm new to CEGUI, so it's very possible that I didn't do something right. What I'm trying to do is to create a transparent titlebar that fills the parent window.

In my XML code that I pasted, do I need to have a FrameWindow as the overall parent? Currently, it is a staticimage window. If so, how do I create a captionless, borderless frame window using XML?

Here is the code for my FrameBkgnd looknfeel.

Thanks,
Brian

Code: Select all

<WidgetLook name="WindowsLook/FrameBkgnd">
 <Property name="CaptionColour" value="FF000000" />
 <ImagerySection name="normal">
  <FrameComponent>
   <Area>
    <Dim type="LeftEdge">
     <AbsoluteDim value="0" />
    </Dim>
    <Dim type="TopEdge">
     <AbsoluteDim value="0" />
    </Dim>
    <Dim type="RightEdge">
     <UnifiedDim scale="1" type="RightEdge" />
    </Dim>
    <Dim type="BottomEdge">
     <UnifiedDim scale="1" type="BottomEdge" />
    </Dim>
   </Area>
  </FrameComponent>
 </ImagerySection>
 <ImagerySection name="caption">
  <TextComponent>
   <Area>
    <Dim type="LeftEdge" ><AbsoluteDim value="12" /></Dim>
    <Dim type="TopEdge" ><AbsoluteDim value="0" /></Dim>
    <Dim type="RightEdge" >
     <UnifiedDim scale="1" type="RightEdge">
      <DimOperator op="Subtract">
       <WidgetDim dimension="Height" />
      </DimOperator>
     </UnifiedDim>
    </Dim>
    <Dim type="BottomEdge" ><UnifiedDim scale="1" type="BottomEdge" /></Dim>
   </Area>
   <ColourProperty name="CaptionColour" />
   <VertFormat type="CentreAligned" />
  </TextComponent>
 </ImagerySection>
 <StateImagery name="Active">
  <Layer>
   <Section section="normal">
    <Colours topLeft="00A7C7FF" topRight="00A7C7FF" bottomLeft="00A7C7FF" bottomRight="00A7C7FF" />
   </Section>
   <Section section="caption" />
  </Layer>
 </StateImagery>
 <StateImagery name="Inactive">
  <Layer>
   <Section section="normal">
    <Colours topLeft="00EFEFEF" topRight="00EFEFEF" bottomLeft="00EFEFEF" bottomRight="00EFEFEF" />
   </Section>
   <Section section="caption" />
  </Layer>
 </StateImagery>
 <StateImagery name="Disabled">
  <Layer>
   <Section section="normal">
    <Colours topLeft="00EFEFEF" topRight="00EFEFEF" bottomLeft="00EFEFEF" bottomRight="00EFEFEF" />
   </Section>
   <Section section="caption" />
  </Layer>
 </StateImagery>
</WidgetLook>

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Postby lindquist » Tue Apr 11, 2006 18:38

can you post the scheme as well?

Evenstar
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Tue Feb 28, 2006 23:14

Postby Evenstar » Tue Apr 11, 2006 19:44

Sure. Here is the line of interest. It was added to the WindowsLookSkin.scheme file. Nothing else was changed.

Code: Select all

<FalagardMapping WindowType="WindowsLook/FrameBkgnd" TargetType="Falagard/Titlebar" LookNFeel="WindowsLook/FrameBkgnd" />

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Postby lindquist » Tue Apr 11, 2006 19:53

You cant have a free floating titlebar atm.
The code is assuming that it is attached to a FrameWindow.

Code: Select all

static_cast<FrameWindow*>(getParent())->toggleRollup();


What exactly is it you want to acheive?

Evenstar
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Tue Feb 28, 2006 23:14

Postby Evenstar » Tue Apr 11, 2006 20:09

Thanks for all the help with this. I appreciate it.

What I'd really like to do is to have a window that can be clicked anywhere an alpha value is non-zero and moved about. For example, having a window with the image of a CD on it would be draggable from all parts except the center and outer edges.

What I was trying to accomplish with the XML code above was to have a static image window as my main window with a transparent title bar window as its child. The title bar window would be made to fit to the width and height of the static image window. This works pretty well, but it allows you to click anywhere in the window (even those places whose alpha values are zero) and move the window.

Does that make any sense?

Thanks.

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Postby lindquist » Tue Apr 11, 2006 20:23

yes that makes sense. CEGUI does'nt currently support masking the the clickable area, so this will be a little hard.

What you can do is strip a frame window for all imagery, and make it's titlebar take up the whole area. This can be done from the looknfeel.
You'd need to make a new titlebar looknfeel as well.

HTH

Evenstar
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Tue Feb 28, 2006 23:14

Postby Evenstar » Tue Apr 11, 2006 20:42

lindquist wrote:You'd need to make a new titlebar looknfeel as well.


Would the titlebar that I created above do the job?

User avatar
lindquist
CEGUI Team (Retired)
Posts: 770
Joined: Mon Jan 24, 2005 21:20
Location: Copenhagen, Denmark

Postby lindquist » Tue Apr 11, 2006 21:14

yeah :) it seems ok

Evenstar
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Tue Feb 28, 2006 23:14

Postby Evenstar » Tue Apr 11, 2006 21:35

One last question (for now). Looking at the existing WindowsLook/FrameWindow, there are many, many NamedAreas. Are these necessary to include in the new frame window? I've never fully understood the NamedAreas.

Thanks

User avatar
martignasse
Just can't stay away
Just can't stay away
Posts: 227
Joined: Thu Apr 14, 2005 08:10
Location: Lyon, FRANCE

Postby martignasse » Wed Apr 12, 2006 06:33

you can look in the Falagard system doc where you'll found all required declaration for the FrameWindow looknfeel :)

Evenstar
Not too shy to talk
Not too shy to talk
Posts: 26
Joined: Tue Feb 28, 2006 23:14

Postby Evenstar » Wed Apr 12, 2006 14:23

How do I specify my titlebar instead of using the default __auto_titlebar__? I tried the following code in the WindowsLook.looknfeel, but it didn't work. I replaced "__auto_titlebar__" with "WindowsLook/FrameBkgnd", the name of my titlebar.


Code: Select all

<NamedArea name="ClientWithTitleNoFrame">
 <Area>
  <Dim type="LeftEdge">
   <AbsoluteDim value="0" />
  </Dim>
  <Dim type="TopEdge">
   <WidgetDim widget="WindowsLook/FrameBkgnd" dimension="BottomEdge" />
  </Dim>
  <Dim type="RightEdge">
   <UnifiedDim scale="1" type="RightEdge" />
  </Dim>
  <Dim type="BottomEdge">
   <UnifiedDim scale="1" type="BottomEdge" />
  </Dim>
 </Area>
</NamedArea>


Thanks


Return to “Modifications / Integrations / Customisations”

Who is online

Users browsing this forum: No registered users and 14 guests