How to set a window height is maximize in qooxdoo?

时间:2017-11-17 11:00:48

标签: javascript qooxdoo

I want to set window height is the full size of my parent component but not possible to set the full size of height.Thank in advance. The following code is a sample snippet of our requirement.

var win = new qx.ui.window.Window("First Window");
win.setAllowMaximize(true)
win.setWidth(300);
//We want to set full height window
win.setBackgroundColor("green");

this.getRoot().add(win, {left:20, top:20});
win.open();

1 个答案:

答案 0 :(得分:1)

设置高度取决于布局。使用操场,就像您在此示例中所看到的那样,默认布局是Canvas,可以指定距各个边的距离。要使用Canvas布局完成您正在寻找的内容,您的示例将被修改为:

var win = new qx.ui.window.Window("First Window");
win.setAllowMaximize(true)
win.setWidth(300);
win.setBackgroundColor("green");

this.getRoot().add(win, {left:20, top:0, bottom:0});
win.open();

或者,您可能需要实际应用程序,您可以使用垂直框布局来放置窗口。在这种情况下,您将使用flex布局功能让此窗口小部件占用容器中的一定比例的空间(在这种情况下,它将使用容器的整个高度):

// Use a vertical box layout instead of the default canvas layout
this.getRoot().setLayout(new qx.ui.layout.VBox());

// Create a window
var win = new qx.ui.window.Window("First Window");
win.setMaxWidth(200);
win.setShowMinimize(false);

// Add the window to the root with flex so that it takes up available space
this.getRoot().add(win, {flex : 1});
win.open();

Derrell