Hi fellow wiki editors!

To help newly registered users get more familiar with the wiki (and maybe older users too) there is now a {{Welcome to the wiki}} template. Have a look at it and feel free to add it to new users discussion pages (and perhaps your own).

I have tried to keep the template short, but meaningful. /Johan G

Howto:Hooking into the GUI

From FlightGear wiki
Revision as of 17:07, 11 March 2018 by Hooray (Talk | contribs) (pm2wiki)

Jump to: navigation, search
This article is a stub. You can help the wiki by expanding it.
fgcommand("register-widget", props.Node.new({
 "module": "ui",
 "name": "image",
 "script": "props.dump( cmdarg() );"

var name = "test";
var myDialog = {};

myDialog[name] = gui.Widget.new();
myDialog[name].set("name", name);
myDialog[name].set("layout", "vbox");

var graph = myDialog[name].addChild("graph");
graph.set("name", "foo");

var code = "io.load_nasal(getprop('sim/fg-root') ~ '/Nasal/foo.bar');";
graph.addChild("nasal").set("load", code);

var cancel = myDialog[name].addChild("button");
cancel.set("key", "Esc");
cancel.set("legend", "Cancel");

#props.dump( myDialog[name].prop() );
fgcommand("dialog-new", myDialog[name].prop() );