Raptor
Raptor

Reputation: 54258

qooxdoo : add a toolbar to Grid layout?

How to add a toolbar to Grid layout ?

var container = new qx.ui.container.Composite();
var layout = new qx.ui.layout.Grid(2,2);
container.setLayout(layout);
var w1 = new qx.ui.core.Widget();

var toolbar = new qx.ui.toolbar.ToolBar();
var btn_status = new qx.ui.toolbar.Button("I am a button");
toolbar.add(btn_status);

container.add(w1, {row: 0, column: 0});
// w1.add(toolbar); // <----
container.set({backgroundColor : "white"});
this.getRoot().add(container, {edge: 0});

If I uncomment the only commented line, the layout will be blank, no error prompted.

What did I miss ? I'm working on qx.Desktop.

Upvotes: 1

Views: 265

Answers (1)

A. Mat&#237;as Quezada
A. Mat&#237;as Quezada

Reputation: 1906

There is not need for the intermediate widget (var w1 = new qx.ui.core.Widget();). Actually qx.ui.core.Widget is not a container, it has no add() method. There's probably an error shown on the Javascript console.

You can add the toolbar directly to the composite.

container.add(toolbar, {row: 0, column: 0});

Upvotes: 2

Related Questions