3

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!

JMT
  • 55
  • 6
  • You seem to be the first Belgian I meet here on sto... at least I'm not the only one ;-) welcome to the forum. – Serge insas Nov 17 '12 at 19:59
  • I am, indeed, from Liège.:-) Thank you very much for your reply. I thought the GUI was considered as a panel you can add to another one. But in fact this is the root one (or any other) inside the GUI that can be added. – JMT Nov 18 '12 at 13:51

1 Answers1

2

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 :

enter image description here

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

The result looks like this :

enter image description here

Serge insas
  • 45,904
  • 7
  • 105
  • 131