FlightGear Newsletter June 2014: Difference between revisions

Jump to navigation Jump to search
no edit summary
(Use new templates; cleanup (except for Canvas stuff, which is too much of a mess right now))
No edit summary
Line 30: Line 30:
On June 17, we entered our scheduled feature freeze state for the next release. Please use the remaining weeks to improve the existing features, harden and cleanup the code, edit the [[Next Changelog|ChangeLog]], improve the Manual, document the undocumented etc. etc. The release branches will be created on July 17th to have the release ready by Aug. 17th.
On June 17, we entered our scheduled feature freeze state for the next release. Please use the remaining weeks to improve the existing features, harden and cleanup the code, edit the [[Next Changelog|ChangeLog]], improve the Manual, document the undocumented etc. etc. The release branches will be created on July 17th to have the release ready by Aug. 17th.


{{Template:Newsletter-article-start|{{{1|Canvas GUI: MessageBox Support}}}|By [[User:Hooray|Hooray]]}}
{{Template:Newsletter-article-start|{{{1|Canvas GUI: MessageBox Support}}}|By [[User:TheTom|TheTom]]}}
Thanks to Tom's and James' recent work on the upcoming [[Aircraft Center]] for downloading and switching between aircraft without having to exit FlightGear, beginning with FlightGear 3.2, FlightGear's [[Canvas]]-based GUI will contain support for so called [[Canvas MessageBox|Message Boxes]]:
Thanks to Tom's and James' recent work on the upcoming [[Aircraft Center]] for downloading and switching between aircraft without having to exit FlightGear, beginning with FlightGear 3.2, FlightGear's [[Canvas]]-based GUI will contain support for so called [[Canvas MessageBox|Message Boxes]]:
{|
{|
Line 92: Line 92:
   }}
   }}
}}
}}
== Creating Canvas GUI Dialogs ==
'''Targeted FlightGear versions: >= 3.20'''
== Editing Translations/en/menu.xml ==
Navigate to the sub-menu where you'd like to add your new dialog, e.g. "Equipment" in this case, and then add a key:
<syntaxhighlight lang="xml">
<equipment>Equipment</equipment>
<canvas-demo-dialog>Canvas Demo Dialog</canvas-demo-dialog>
</syntaxhighlight>
== Editing gui/menubar.xml ==
Next, open $FG_ROOT/gui/menubar.xml and navigate to the corresponding sub-menu and add a new item/binding to load your dialog:
<syntaxhighlight lang="xml">
<item>
<name>canvas-demo-dialog</name>
<binding>
<command>nasal</command>
<script>
canvas.loadDialog("CanvasDemo");
</script>
</binding>
</item>
</syntaxhighlight>
== Creating the actual dialog file ==
{{Note|These dialog files can be edited at run-time and simply closed/re-opened, because the Canvas system will reload them from disk whenever the menu binding is triggered. So this is very convenient for quickly developing and testing your dialogs.}}
Next, open/create $FG_ROOT/Nasal/canvas/gui/dialogs/CanvasDemo.nas and add some boilerplate code:
<syntaxhighlight lang="nasal">
var DemoDialog = {
  new: func
  {
    var m = {
      parents: [DemoDialog],
      _dlg: canvas.Window.new([400,300], "dialog")
                        .set("title", "Demo Dialog")
                        .set("resize", 1),
      _active_button: nil
    };
    m._dlg.getCanvas(1)
          .set("background", canvas.style.getColor("bg_color"));
    m._root = m._dlg.getCanvas().createGroup();
    var vbox = VBoxLayout.new();
    m._dlg.setLayout(vbox);
    return m;
  },
};
var demo = DemoDialog.new();
</syntaxhighlight>
Finally, start FlightGear and open your new dialog
== Adding Widgets ==
== Using Layouts ==
== Using Styling ==


=== 777 EFB Prototype by I-NEMO ===
=== 777 EFB Prototype by I-NEMO ===

Navigation menu