Learning Qooxdoo - 3
来源:互联网 发布:尚硅谷数据采集系统 编辑:程序博客网 时间:2024/06/03 07:25
The basic steps to create a qooxdoo application is as 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 many widgets as you can to container.
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 the 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 many 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 between 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 the extra space. Growing is proportional to flex value.
- Learning Qooxdoo - 3
- Learning Qooxdoo - 1
- Learning Qooxdoo - 2
- qooxdoo
- qooxdoo简介
- qooxdoo简介
- qooxdoo简介
- qooxdoo简介
- qooxdoo简介
- qooxdoo.js使用手记
- Develop Log - Qooxdoo Widget
- qooxdoo example 图片
- qooxdoo example 图片
- qooxdoo example 图片
- qooxdoo example 图片
- qooxdoo example 图片
- qooxdoo开发入门
- qooxdoo第一个程序
- Learning Rhino - 2
- Learning Rhino - 3
- mysql防注入
- Learning Qooxdoo - 1
- Learning Qooxdoo - 2
- Learning Qooxdoo - 3
- Learning FaceBook Connect
- Observer pattern in JavaScript
- jQuery tips and tricks - 1
- Strange - the page is loading twice
- jQuery tips and tricks - 2
- Step by step to create a jQuery tabs plugin - 1
- Step by step to create a jQuery tabs plugin - 2
- Step by step to create a jQuery tabs plugin - 3