Canvas snippets
Jump to navigation
Jump to search
This article is a stub. You can help the wiki by expanding it. |
Work in progress This article or section will be worked on in the upcoming hours or days. See history for the latest developments. |
The FlightGear forum has a subforum related to: Canvas |
Creating a Canvas GUI Window
Note This example uses so called method chaining, if you're not familiar with the concept, please see: Method Chaining. |
# create a new window, dimensions are 320 x 160, using the dialog decoration (i.e. titlebar)
var window = canvas.Window.new([320,160],"dialog");
# adding a canvas to the new window and setting up background colors/transparency
var myCanvas = window.createCanvas().setColorBackground(1,1,1,1);
# creating the top-level/root group which will contain all other elements/group
var root = myCanvas.createGroup();
Canvas Input Dialog
# create a new InputDialog with a title, label, and a callback
canvas.InputDialog.getText("Input Dialog Title", "Please enter some text", func(btn,value) {
if (value) gui.popupTip("You entered: "~value);
});