ProgressBar incompatible with relative positioning?

trilader

26-02-2011 22:34:49

Hi,
when I try to position a ProgressBar relative to it's parent window like the bar's position resets itself when I click Test in the editor or load it in my application.

Part of my layout:...SNIP...
<Widget type="ProgressBar" skin="ProgressBarFill" position_real="0.05 0.05 0.9 0.25" name="PlayerInfo_HP_Bar">
<Property key="Range" value="1000"/>
<Property key="Position" value="400"/>
<Property key="FlowDirection" value="LeftToRight"/>
<Property key="Colour" value="1 0 0.3"/>
</Widget>
...SNIP...

Here is a picture of my problem:


I hope somebody has an idea of whats wrong and tell me how to fix my problem.

Regards
-trilader

Altren

26-02-2011 23:17:15

There was bug in old LayoutEditor - it was calculating relative positions wrong. What version of MyGUI do you use?
I recommend you to use non-relative sizes, because there is almost no advantages of using relative size for non root widgets.

trilader

27-02-2011 09:00:13

I am using MyGUI 3.2 RC1. I use relative positioning to keep my layout screen resolution independent. If there is a way to keep my layout, and the widgets inside the window, sized and positioned in a resolution independent manner without "position_real" please tell me.

Regards
-trilader

Altren

27-02-2011 20:38:52

I just checked - actually this bug in LayoutEditor was fixed after 3.2.0RC1. So you should either wait for 3.2.0 release or use version from svn for a while.

trilader

27-02-2011 20:41:02

OK, thanks for your help. I'll build the editor from the svn in the mean time

Regards
-trilader

trilader

02-03-2011 15:29:42

Ok, I built the new layout editor from SVN version 4177 today. The behaviour of the editor is still the same as it was in 3.2RC1.
Another thing that's bugging me is that the layout editor always "rounds" the position/size values of relativly positioned widgets e.g.: "0.05 0.05 0.9 0.25" becomes "0.048951 0.0430108 0.895105 0.247312". I know that the values are stored as floats, but afaik floating point errors normally occour after a lot more that 2 decimal places.

Any ideas for that?

Regards
-trilader

Altren

02-03-2011 15:59:55

I just tried to reproduce your bug with wrong positioning - everything works fine in both LE and in app.
Created window, child ProgressBar set position mode to percents and set "5 5 90 25".
So either show full layout or write full steps to reproduce bug.

What about "rounding" - this is how relative positioning is implemented: widget can have only integer position and size, so when you set position 0.05 0.05 is is converted into, f.e. 4 3 and when you read it this values are divided by parent's size.

trilader

02-03-2011 16:47:27

Here is my full layout code:<?xml version="1.0" encoding="UTF-8"?>
<MyGUI type="Layout" version="3.2.0">
<Widget type="Window" skin="WindowCS" position_real="0 0.05 0.15 0.13" layer="Main" name="PlayerInfo_Window">
<Property key="Caption" value="PlayerName lvl. 5"/>
<Property key="Snap" value="true"/>
<Widget type="ProgressBar" skin="ProgressBarFill" position_real="0.05 0.05 0.9 0.25" name="PlayerInfo_HP_Bar">
<Property key="Range" value="1000"/>
<Property key="Position" value="400"/>
<Property key="FlowDirection" value="LeftToRight"/>
<Property key="Colour" value="1 0 0.3"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position_real="0.05 0.05 0.9 0.25" name="PlayerInfo_HP">
<Property key="TextAlign" value="Center"/>
<Property key="Caption" value="400/1000"/>
<Property key="Alpha" value="0.8"/>
<Property key="InheritsAlpha" value="false"/>
</Widget>
<Widget type="ProgressBar" skin="ProgressBarFill" position_real="0.05 0.35 0.9 0.25" name="PlayerInfo_SP_Bar">
<Property key="Colour" value="0 1 0.3"/>
<Property key="Range" value="1000"/>
<Property key="Position" value="300"/>
<Property key="FlowDirection" value="LeftToRight"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position_real="0.05 0.35 0.9 0.25" name="PlayerInfo_SP">
<Property key="TextAlign" value="Center"/>
<Property key="Caption" value="300/1000"/>
<Property key="Alpha" value="0.8"/>
<Property key="InheritsAlpha" value="false"/>
</Widget>
<Widget type="ProgressBar" skin="ProgressBarFill" position_real="0.05 0.65 0.9 0.25" name="PlayerInfo_Exp_Bar">
<Property key="Range" value="1000"/>
<Property key="Position" value="200"/>
<Property key="FlowDirection" value="LeftToRight"/>
<Property key="Colour" value="0 0.4 1"/>
</Widget>
<Widget type="TextBox" skin="TextBox" position_real="0.05 0.65 0.9 0.25" name="PlayerInfo_Exp">
<Property key="Caption" value="200/1000"/>
<Property key="TextAlign" value="Center"/>
<Property key="Alpha" value="0.8"/>
<Property key="InheritsAlpha" value="false"/>
</Widget>
</Widget>
</MyGUI>


What I mean with the rounding issues is that I set the values in the layout above by hand with a text editor. When I open this layout with the editor and change someting it gets all "messed up". This happens every time somethin in the layout is changed so when I do multiple edit "iterations" the widgets position starts to move away from their original positions.

Regards
-trilader

edit:
Another thing I want to know is if it is possible to make the black part of the ProgressBar (the one the cursor is pointing at) strech all the way to the bottom of the ProgressBar.