With this code found here : http://wiki.flightgear.org/Canvas_Snippets (Adding GUI Buttons), how is it possible to change the button position ?
- Code: Select all
var (width,height) = (300,500);
var tittle = "Test";
var window = canvas.Window.new([width,height], "dialog")
.set("title", tittle);
var myCanvas = window.createCanvas().set("background", canvas.style.getColor("bg_color"));
var root = myCanvas.createGroup();
var myLayout = canvas.VBoxLayout.new();
myCanvas.setLayout(myLayout);
var button = canvas.gui.widgets.Button.new(root,canvas.style,{})
.setText("click")
.setFixedSize(75,25)
.move(100,200);
button.listen("clicked",func {
print("button clicked");
});
myLayout.addItem(button);
The line ".move(100,200)" in the button function doesn't work.