Updated loadWidgetsFromFile documentation?

Started by CombatWombat, 30 October 2013, 02:18:35


I'm confused on loading from file.  I know the form builder is/was under major overhaul, but I'm not sure of the current status of what is and is not working.

If I have a text form that looks like:
Window: "Form Window"
Button: "Button1"
ConfigFile = "widgets/White.conf"
Left = 180
Top = 100
Width = 121
Height = 30
Visible = true
Enabled = true
Transparency = 255
CallbackId = 0
Text = "MegaButton"
TextColor = (0,0,0,255)
TextSize = 17

If I load into the "main gui container"

tgui::Gui gui;

I get a button in the middle of my main program window.  What does "Window: Form Window" refer to in the form?  Isnt the gui object already the "window" in this case, with the button being a child in it?  The "form.txt" implies the button lives inside a container called "Form Window".  The C program implies that the button lives inside the container "gui".

If I do...

tgui::ChildWindow::Ptr aChildWindow(gui);
aChildWindow->setTitle("Hard Coded Child Window");

Now the button rides along inside the child window, which lives inside the "gui" container.  What does the "Window: Form Window" refer to?  It seems like a wasted identifier, since the button is living inside "Hard Coded Child Window", but the button doesn't work at all if I strip out the "Window { }" from the text file.

My first try was to hard code containers, and have each one load his widgets from a form file.  This *kind of* works, but I am confused over the nested syntax of the form text files.  (The Window {} part seems redundant and contradictory).

It appears forms do not yet support containers directly.  IE:

       Button: "Yay Im a Button"
        // button stuff

If/when they do, I suspect it will help because larger chunks of GUI could be "soft coded" in text files.


There is one thing to understand about the widget files: the 'Window: ""' does absolutely nothing :).

It is preserved from previous versions where the Gui class was still called Window, but that is not the real reason for this Window line.
The idea was that you would be able to place multiple windows/frames into a single text file and then you would tell loadWidgetsFromFile which one to load.  However this has not yet been supported and the line is indeed redundant.

I haven't decided yet what to do with the Window part. But it isn't really a big issue, you can still do everything including loading child windows, as long as you have the whole file in a Window block.