Learning qooxdoo-3

Source: Internet
Author: User

The basic steps to create a qooxdoo application is
Follows
:

    1. Select a layout (vbox, hbox, grid, dock ....)
    2. Create a container from the layout. (usually composite)
    3. Add the container to the application root (document ).
    4. 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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.