是否可以在另一个面板中嵌入使用GUI生成器构建的GUI? [英] Is it possible to embed a GUI built with GUI builder in another panel?

查看:148
本文介绍了是否可以在另一个面板中嵌入使用GUI生成器构建的GUI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用GUI Builder创建了一些GUI部件,我想将它们嵌入到脚本的面板中,而不是直接在应用程序中添加它们。
但显然,这样的代码不起作用:

  var app = UiApp.createApplication(); 
var vp = app.createVerticalPanel();
vp.add(app.loadComponent(myGUI));
app.add(vp);
返回应用程序;

是否可以将GUI Builder中的GUI添加到除应用程序之外的其他容器中?



谢谢!

解决方案

 函数doGet(){
var app = UiApp.createApplication()
var Panel = app。 createAbsolutePanel()。setStyleAttribute('background','beige')。setPixelSize(400,600);
var label = app.createLabel('gui test')
var gui = app.loadComponent('MyGui')
Panel.add(app.getElementById('VerticalPanel1'))
Panel.add(标签)
app.add(面板)
返回应用程序
}

,GUI看起来像这样:


不添加组件,而是添加包含所有其他小部件的面板(在本例中为'VerticalPanel1')。 / p>

结果如下所示:


I've created some GUI parts with GUI Builder and I wanted to embed them in panels of my scripts, instead of adding them directly in the app. But apparently, a such code doesn't work:

  var app = UiApp.createApplication();
  var vp = app.createVerticalPanel();
  vp.add(app.loadComponent("myGUI"));
  app.add(vp);
  return app;

Is it (or will it be) possible to add GUI's from GUI Builder in other containers than app?

Thanks!

解决方案

You can do it like in this example

function doGet() {
  var app = UiApp.createApplication()
  var Panel = app.createAbsolutePanel().setStyleAttribute('background', 'beige').setPixelSize(400,600);
  var label = app.createLabel('gui test')
  var gui = app.loadComponent('MyGui')
  Panel.add(app.getElementById('VerticalPanel1'))
  Panel.add(label)
  app.add(Panel)
  return app
  }

and the GUI looks like this :

Instead of adding the component I added the panel (in this example 'VerticalPanel1') that contains all the other widgets.

The result looks like this :

这篇关于是否可以在另一个面板中嵌入使用GUI生成器构建的GUI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆