Howto:Hooking into the GUI

From FlightGear wiki
Revision as of 17:15, 11 March 2018 by Hooray (Talk | contribs) (Registering the pre-processor)

Jump to: navigation, search
This article is a stub. You can help the wiki by expanding it.

Registering the pre-processor

Note  This works analogous to the existing addcommand() API - but it will be treated like an fgcommand that gets a handle to the widgets props.Node via the cmdarg() API. That way, the whole thing is mutable, too. In other words, the following 5 lines of code can be used to customize widgets and create entirely new ones in scripting space.
 "module": "ui",
 "name": "image",
 "script": "props.dump( cmdarg() );"

Testing the new tag/widget

See Nasal Console

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

myDialog =;
myDialog.set("name", name);
myDialog.set("layout", "vbox");

var image = myDialog.addChild("image");
image.set("name", "someImage");

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

fgcommand("dialog-new", myDialog.prop() );