createWidgetReal positioning strangely? (3.01)

Elspin

10-06-2011 01:34:38

So I'm just trying to create a simple popup window for a login screen and I'm having a strange problem with how the entity is being aligned. I'm not sure if this is a bug or if I'm just misunderstanding how MyGUI does it's relative positioning, but I made a simple window in the layout editor looking like so:



and then copied the relative positions into my code, and at the exact same rendering settings and resolution this came out:



the code for the window is here:

MyGUI::WindowPtr mainMenu = mGUI->findWidget<MyGUI::Window>("MainMenu");

MyGUI::WindowPtr loginWindow = mainMenu->createWidgetReal<MyGUI::Window>("WindowCSX", 0.5-.2, 0.5-.1, 0.4, 0.2, MyGUI::Align::Default, "LoginWindow");
loginWindow->setCaption("Login Details");

MyGUI::StaticTextPtr usernameText = loginWindow->createWidgetReal<MyGUI::StaticText>("StaticText", 0.026, 0.107, 0.161, 0.185, MyGUI::Align::Default);
usernameText->setCaption("Username:");

MyGUI::StaticTextPtr passwordText = loginWindow->createWidgetReal<MyGUI::StaticText>("StaticText", .026, .488, .159, .190, MyGUI::Align::Default);
passwordText->setCaption("Password:");

MyGUI::EditPtr usernameEdit = loginWindow->createWidgetReal<MyGUI::Edit>("Edit", .217, .06, .763, .238, MyGUI::Align::Default, "UsernameEdit");

MyGUI::EditPtr passwordEdit = loginWindow->createWidgetReal<MyGUI::Edit>("Edit", .217, .44, .763, .238, MyGUI::Align::Default, "PasswordEdit");

MyGUI::ButtonPtr loginButton = loginWindow->createWidgetReal<MyGUI::Button>("Button", .026, .77, .954, .19, MyGUI::Align::Default, "LoginButton");
loginButton->setCaption("Login");


Is this just a bug with 3.0.1, or have I done something wrong here that I just can't find?

Altren

10-06-2011 14:44:17

There was bug in the old LayoutEditor, it was calculating relative positions wrong (ignored caption size). So if you copy this values from the Layout Editor use some simple widget instead of Windows to get proper position values.

Elspin

11-06-2011 01:54:28

There was bug in the old LayoutEditor, it was calculating relative positions wrong (ignored caption size). So if you copy this values from the Layout Editor use some simple widget instead of Windows to get proper position values.

Well, it was the newest version of the LayoutEditor, but either way I'm more concerned about the values overlapping. if a button is set to start 77% of the way down a window, and is set to be 19% of the window tall, 19+77 = 96, which is less than 100%. The layout editor appears to be doing relative positioning exactly right by the math, and the code I wrote somehow appears to be doing this wrong when I run it (as you can see, the button starts at about 90% and extends past the end of the window)

This is my question, is this a bug with 3.0.1 that I should just get 3.2 to fix? Or is there something else I need to do in code that I haven't called?