【问题标题】:How to set a window height is maximize in qooxdoo?如何在qooxdoo中设置窗口高度最大化?
【发布时间】:2018-05-01 03:22:30
【问题描述】:

我想将窗口高度设置为父组件的完整大小,但无法设置高度的完整大小。提前致谢。 以下代码是我们要求的示例 sn-p。

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();

【问题讨论】:

    标签: javascript qooxdoo


    【解决方案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();
    

    德雷尔

    【讨论】:

      猜你喜欢
      • 2018-03-08
      • 2018-12-11
      • 1970-01-01
      • 2014-05-21
      • 2023-02-18
      • 1970-01-01
      • 1970-01-01
      • 2020-02-10
      • 2013-01-08
      相关资源
      最近更新 更多