The basic steps to create a qooxdoo application is
Follows:
- Select a layout (vbox, hbox, grid, dock ....)
- Create a container from the layout. (usually composite)
- Add the container to the application root (document ).
- Add as container widgets as you can to iner.
Following is an example to create three button to a vbox container.
VaR layout = new QX. UI. layout. vbox ();
VaR Container = new QX. UI. Container. Composite (layout );
This. getroot (). Add (container );
Container. Add (New QX. UI. Form. Button ('this is a button 1 '));
Container. Add (New QX. UI. Form. Button ('this is a button 2 '));
Container. Add (New QX. UI. Form. Button ('this is a button 3 '));
There is an convenient way to run qooxdoo code is the playground. Just copy
The code and paste it into the source code editor, click Run button.
Next, we want the button fill all the width of
Viewport
VaR layout = new QX. UI. layout. vbox ();
VaR Container = new QX. UI. Container. Composite (layout );
Container. setwidth (QX. Bom. viewport. getwidth ());
Container. setheight (QX. Bom. viewport. getheight ());
This. getroot (). Add (container );
Container. Add (New QX. UI. Form. Button ('this is a button 1 '));
Container. Add (New QX. UI. Form. Button ('this is a button 2 '));
Container. Add (New QX. UI. Form. Button ('this is a button 3 '));
We have always ways to set width and height of the container:
Like this:
Container. Set ({
Width: QX. Bom. viewport. getwidth (),
Height: QX. Bom. viewport. getheight ()
});
And this:
Container. Set ('width', QX. Bom. viewport. getwidth ());
Container. Set ('height', QX. Bom. viewport. getheight ());
There is also an easy way to do this, set the edge to 0px:
VaR layout = new QX. UI. layout. vbox ();
VaR Container = new QX. UI. Container. Composite (layout );
This. getroot (). Add (container, {edge: 0 });
Container. Add (New QX. UI. Form. Button ('this is a button 1 '));
Container. Add (New QX. UI. Form. Button ('this is a button 2 '));
Container. Add (New QX. UI. Form. Button ('this is a button 3 '));
You can modify the edge value to see the result in action.
Finally, we want the button to fill the height of the container:
VaR layout = new QX. UI. layout. vbox ();
VaR Container = new QX. UI. Container. Composite (layout );
This. getroot (). Add (container, {edge: 0 });
Container. Add (New QX. UI. Form. Button ('this is a button 1'), {flex: 0 });
Container. Add (New QX. UI. Form. Button ('this is a button 2'), {flex: 1 });
Container. Add (New QX. UI. Form. Button ('this is a button 3'), {flex: 1 });
The Flex is an importent option to control the vertical behavior, just as this
Article say:
Flex property determines how the extra space2 is distributed
Children. By default it is set to 0, which means that the widget will not grow
Vertically. Any other (integer) value for FLEX will cause growing to occupy
Extra space. Growing is proportional to flex value.