Nasal in GUI dialog files: Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
mNo edit summary
mNo edit summary
Line 42: Line 42:


A bunch of helpers for creating scripted GUI dialogs can be found in $FG_ROOT/Nasal/gui.nas
A bunch of helpers for creating scripted GUI dialogs can be found in $FG_ROOT/Nasal/gui.nas
Each dialog can have a <nasal> block with <open> and/or <close> element. Nasal code therein is executed on dialog opening and closing. This code and all Nasal code in the dialog bindings run in the same namespace, so one can initialize variables and functions in the <open> block and access them from everywhere in the file. The <close> block is for cleaning up (removing listeners, canceling timers, removing properties etc.)
This allows to write more sophisticated dialogs, and makes external dialog helper *.nas files unnecessary (e.g. the autopilot *.nas file).  There's currently one dialog using this feature: location-in-air.xml, which handles the <radio>buttons with embedded Nasal.
read more here: http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg02016.html

Revision as of 17:46, 16 October 2011

As of 10/2011 there is unfortunately no dedicated article available yet, but for the time being you can refer to $FG_ROOT/gui/dialogs, where you can find a number of GUI dialogs containing embedded Nasal code, you'll want to look for sections (tags) named nasal/open and nasal/close:

  • about.xml
  • airports.xml
  • autopilot.xml
  • chat-menu.xml
  • file-select.xml
  • formation.xml
  • gps.xml
  • hud.xml
  • jetways-adjust.xml
  • jetways.xml
  • joystick-info.xml
  • location-in-air.xml
  • location-on-ground.xml
  • lso-view.xml
  • map.xml
  • marker-adjust.xml
  • message.xml
  • model-cockpit-view.xml
  • model-view-select.xml
  • model-view.xml
  • multiplayer.xml
  • nasal-console.xml
  • NTPS_target_task.xml
  • property-browser.xml
  • pushback.xml
  • random-failures.xml
  • rendering.xml
  • replay.xml
  • route-manager.xml
  • scenario.xml
  • seaport.xml
  • sound.xml
  • stopwatch.xml
  • system-failures.xml
  • terrasync.xml
  • tutorial.xml
  • view.xml
  • weather.xml


A bunch of helpers for creating scripted GUI dialogs can be found in $FG_ROOT/Nasal/gui.nas


Each dialog can have a <nasal> block with <open> and/or <close> element. Nasal code therein is executed on dialog opening and closing. This code and all Nasal code in the dialog bindings run in the same namespace, so one can initialize variables and functions in the <open> block and access them from everywhere in the file. The <close> block is for cleaning up (removing listeners, canceling timers, removing properties etc.)

This allows to write more sophisticated dialogs, and makes external dialog helper *.nas files unnecessary (e.g. the autopilot *.nas file). There's currently one dialog using this feature: location-in-air.xml, which handles the <radio>buttons with embedded Nasal.

read more here: http://www.mail-archive.com/flightgear-devel@lists.sourceforge.net/msg02016.html