Howto:Hooking into the GUI: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
</syntaxhighlight>
</syntaxhighlight>


== Registering the pre-processor ==
<syntaxhighlight lang="nasal">
<syntaxhighlight lang="nasal">
fgcommand("register-widget", props.Node.new({
fgcommand("register-widget", props.Node.new({
Line 13: Line 14:




==  Testing the new tag/widget ==
See [[Nasal Console]]
<syntaxhighlight lang="nasal">
<syntaxhighlight lang="nasal">
var name = "test";
var name = "test";

Revision as of 21:14, 11 March 2018

This article is a stub. You can help the wiki by expanding it.

Registering the pre-processor

fgcommand("register-widget", props.Node.new({
 "module": "ui",
 "name": "image",
 "script": "props.dump( cmdarg() );"
}));


Testing the new tag/widget

See Nasal Console

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

myDialog = gui.Widget.new();
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");
cancel.setBinding("dialog-close");

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



Related

References