Window defined in XML layout not showing up

For help with general CEGUI usage:
- Questions about the usage of CEGUI and its features, if not explained in the documentation.
- Problems with the CMAKE configuration or problems occuring during the build process/compilation.
- Errors or unexpected behaviour.

Moderators: CEGUI MVP, CEGUI Team

matches81
Just popping in
Just popping in
Posts: 11
Joined: Sun Dec 21, 2008 22:03

Window defined in XML layout not showing up

Postby matches81 » Wed Jan 14, 2009 15:14

Hello there!

I've finally come around to switching from hard-coded menu structures to using XML layout files for CEGUI.
For my main menu, this works fine. I have on .layout for each submenu, load these when needed and simply call setGUISheet(...) with the currently needed submenu sheet.

However, one layout doesn't seem to work as expected for me:

Code: Select all

<?xml version="1.0" ?>
<GUILayout>
   <Window Type="DefaultGUISheet" Name="TankGame/PlayerSetupStateMenu">
      <Property Name="InheritsAlpha" Value="false"/>
      <Property Name="Alpha" Value="0.0"/>
      <Property Name="UnifiedPosition" Value="{{0.001, 0},{0.001, 0}}"/>
      <Property Name="UnifiedSize" Value="{{0.999, 0},{0.999, 0}}"/>
      
      <Window Type="TaharezLook/StaticText" Name="TankGame/PlayerSetupStateMenu/Frame">
         <Property Name="InheritsAlpha" Value="false" />
         <Property Name="Alpha" Value="1.0" />
         <Property Name="UnifiedPosition" Value="{{0.03, 0},{0.03, 0}}" />
         <Property Name="UnifiedSize" Value="{{0.94, 0}, {0.13, 0}}" />
      </Window>
      
      <Window Type="TaharezLook/Button" Name="TankGame/PlayerSetupStateMenu/BackButton">
         <Property Name="UnifiedPosition" Value="{{0.1052, 0},{0.8008, 0}}"/>
         <Property Name="UnifiedSize" Value="{{0.282, 0},{0.056, 0}}"/>
         <Property Name="Text" Value="Back"/>
         <Property Name="InheritsAlpha" Value="false"/>
         <Property Name="Alpha" Value="1.0"/>
      </Window>
      
      <Window Type="TaharezLook/Button" Name="TankGame/PlayerSetupStateMenu/AcceptButton">
         <Property Name="UnifiedPosition" Value="{{0.6128, 0},{0.8008, 0}}"/>
         <Property Name="UnifiedSize" Value="{{0.282, 0},{0.056, 0}}"/>
         <Property Name="Text" Value="Accept"/>
         <Property Name="InheritsAlpha" Value="false"/>
         <Property Name="Alpha" Value="1.0"/>
      </Window>
   </Window>
</GUILayout>


When I switch to this layout I only see the two buttons "Accept" and "Back", the rest doesn't show up. I would have expected to see the element "Frame" with all its children at the top edge of my sheet, a whole lot of empty space and the two buttons already mentioned.
I tried fiddling around with the alpha settings (even going back to Alpha = 1 for all elements), but no success.

The code used for loading and displaying is pretty straight-forward:

Code: Select all

using namespace CEGUI;

WindowManager& wndMgr = CEGUI::WindowManager::getSingleton();
try
{
   m_pMainWnd = wndMgr.loadWindowLayout("GameSetupState.layout");
}
catch(CEGUI::FileIOException&) {throw;}
catch(CEGUI::InvalidRequestException&) {throw;}
catch(CEGUI::AlreadyExistsException&) {throw;}

FinishGUI(); // subscribes to events, fills comboboxes etc...

CEGUI::System::getSingleton().setGUISheet(m_pMainWnd);

That's it. FinishGUI() does nothing to change visibility of the elements, btw.
The CEGUI log and the Ogre log don't show any errors, I don't get any exceptions and all the elements from the layout I access in FinishGUI seem to be fine.

Does anybody see the issue here?

PS: I'm using CEGUI 0.51 together with Ogre 1.6

[edit]
Replaced the large layout with a smaller example (the layout for the next menu, actually). The result is the same: The two buttons are visible, the StaticText element isn't.

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Postby Jamarr » Wed Jan 14, 2009 19:33

You need to remove the space between the dimensions in your UnifiedSize property. Eg:

<Property Name="UnifiedSize" Value="{{0.94, 0}, {0.13, 0}}" />

should be:
<Property Name="UnifiedSize" Value="{{0.94, 0},{0.13, 0}}" />

matches81
Just popping in
Just popping in
Posts: 11
Joined: Sun Dec 21, 2008 22:03

Postby matches81 » Wed Jan 14, 2009 20:23

Thx, that actually worked.

But can it get any more error-prone than that?

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

Postby CrazyEddie » Wed Jan 14, 2009 21:33

I meant to fix parsing of these values a while back in order to make it more robust, but it never got done. I'll add a mantis ticket so it's not forgotten again.

CE.

matches81
Just popping in
Just popping in
Posts: 11
Joined: Sun Dec 21, 2008 22:03

Postby matches81 » Thu Jan 15, 2009 10:29

CrazyEddie wrote:I meant to fix parsing of these values a while back in order to make it more robust, but it never got done. I'll add a mantis ticket so it's not forgotten again.

CE.

Thx.

I didn't mean to be rude... it just was pretty annoying to waste half a day on this. So far, CEGUI has been a pleasant experience and I appreciate the work put into it.
So, sorry for the "outburst".

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Postby Jamarr » Thu Jan 15, 2009 19:31

I believe the latest version of CEGUI uses the Expat xml-parser by default? I wonder which XML parser you where using? I wonder if you where using Xalan, which has schema validation, if it would have caught and notified you of this error.

I personally use TinyXml, but I'm thinking of switching to Xalan. It is probably best to use a parser that can do schema validation so you don't get stuck on these kinds of issues.

As a side note, if you want stick with the parser you are using, I believe CE has written an external XML validation tool that you can also use (I haven't tried it myself): https://crayzedsgui.svn.sourceforge.net ... tor/trunk/

Of course I am assuming the schemas are properly setup and would have caught the error in this expression.

matches81
Just popping in
Just popping in
Posts: 11
Joined: Sun Dec 21, 2008 22:03

Postby matches81 » Fri Jan 16, 2009 11:45

Jamarr wrote:I believe the latest version of CEGUI uses the Expat xml-parser by default? I wonder which XML parser you where using? I wonder if you where using Xalan, which has schema validation, if it would have caught and notified you of this error.

The parser I use, because it's CEGUI's default XML parser, is Expat, yes.
I haven't spent any time considering using a different XML parser, though, and I don't know how much work it is using a different one with CEGUI.
As my project is rather tiny (i.e. only me) and I vowed to myself to get more into the game aspect of the whole thing soon, I'm a bit reluctant to make that change.
Jamarr wrote:As a side note, if you want stick with the parser you are using, I believe CE has written an external XML validation tool that you can also use (I haven't tried it myself): https://crayzedsgui.svn.sourceforge.net ... tor/trunk/

I'll look into that, thanks for the tip.

Jamarr wrote:Of course I am assuming the schemas are properly setup and would have caught the error in this expression.

I'm no expert for XML, of course, but I guess no XML validation would have caught this, as it's a format error inside a string. I'm assuming this string is passed to CE for further parsing and that's where the issue lies (i.e. spaces are not removed for strings that aren't supposed to have any)

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

Postby CrazyEddie » Fri Jan 16, 2009 14:48

I didn't mean to be rude... it just was pretty annoying to waste half a day on this. So far, CEGUI has been a pleasant experience and I appreciate the work put into it.
So, sorry for the "outburst".

Hey, no problem - that's nothing to how some people behave ;) When you put yourself out there like we do with this project you have to not let such things get to you anyway :P

I'm assuming this string is passed to CE for further parsing and that's where the issue lies (i.e. spaces are not removed for strings that aren't supposed to have any)

This is correct.

CE.

Pompei2
Home away from home
Home away from home
Posts: 489
Joined: Tue May 23, 2006 16:31

Postby Pompei2 » Sat Jan 17, 2009 01:13

matches81 wrote:As my project is rather tiny (i.e. only me) and I vowed to myself to get more into the game aspect of the whole thing soon, I'm a bit reluctant to make that change.

If your project is tiny, use TinyXML ;) (no joke), as it is built into CEGUI directly, there is no need for any more dll or so. I like it very much!

Jamarr
CEGUI MVP
CEGUI MVP
Posts: 812
Joined: Tue Jun 03, 2008 23:59
Location: USA

Postby Jamarr » Wed Jan 21, 2009 16:54

CrazyEddie wrote:
I'm assuming this string is passed to CE for further parsing and that's where the issue lies (i.e. spaces are not removed for strings that aren't supposed to have any)

This is correct.


True. I was assuming that the schemas where setup to do regular expression validation. However, after closer inspection it seems the CEGUI schemas do not do any validation (they accept the string in any form) so in this case would not have been helpful.

However, if the schemas where updated to use regular expression validation they could potentially catch errors like these; assuming of course that the validation expression in the schema matches the parser exactly.


Return to “Help”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 26 guests