* Melchior FRANZ -- Tuesday 08 November 2005 10:14:
> The bo's and c150's dialogs are currently on the <Tab> key.

Both dialogs are defined entirely in Nasal, which may look a bit scary
for Nasal beginners. It's easier to use a regular gui xml for such
aircraft specific dialogs. Just put them into the aircraft dir and
from the *-set.xml file load them into the property tree:

  <sim>
     ...
      <model>
          <foo>            <!-- that's our aircraft name :-) -->
              <dialogs>
                  <dialog include="settings-dialog.xml"/>
                  <dialog include="material-dialog.xml"/>
                  ...
              </dialogs>
          </foo>
      </model>
  ...
  </sim>



Then you put something like this somewhere in Nasal context:

  settings_dialog = nil;
  INIT = func {
      dlg = props.globals.getNode("/sim/model/foo/dialogs/dialog[0]", 1);

      # let's add a button, just for fun
      dlg.getNode("button/legend", 1).setValue("Boo!");
      fgcommand("dialog-new", dlg);

      # dialog must contain <name>foo-settings</name>!
      settings_dialog = props.Node.new({"dialog-name": "foo-settings"});
  }
  settimer(INIT, 0);



and as a key binding you define for example:

  <key n="5">
      <name>Ctrl-E</name>
      <desc>Open settings dialog</desc>
      <binding>
          <command>nasal</command>
          <script>fgcommand("dialog-show", foo.settings_dialog)</script>
      </binding>
  </key>


m.

_______________________________________________
Flightgear-devel mailing list
[email protected]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to