<?xml version="1.0"?>

<PropertyList>
	<name>power-output-dialog</name>
	<x>-2</x>
	<y>2</y>
	<layout>hbox</layout>
	<default-padding>2</default-padding>

  <canvas>
      <name>power</name>
      <valign>fill</valign>
      <halign>fill</halign>
      <stretch>true</stretch>
      <pref-width>230</pref-width>
      <pref-height>100</pref-height>
      <nasal>      
          <!--
              this is the Nasal/canvas section where you can run your own Nasal code 
              to access the canvas section 
          -->
          <load>
              <![CDATA[
              # you can add your canvas-specific code here
              var my_canvas = canvas.get( cmdarg() ); # this will get a handle to the parent canvas:

              var root = my_canvas.createGroup();
              var text = root.createChild("text")
                  .setText("0")
                  .setTranslation(20, 20)
                  .setAlignment("left-top")
                  .setFontSize(90)
                  .setFont("LiberationFonts/LiberationSans-Regular.ttf")
                  .set("max-width", 230)
                  .setColor(1,1,1);

              var power_output_loop = func { 
                  text.setText(sprintf("%4.0f", getprop("fdm/jsbsim/human-output/electric-motor")));
              }

              var power_output_timer = maketimer(0.25, func{power_output_loop()});
              power_output_timer.start();

              ]]>
          </load>
          <unload>
              power_output_timer.stop();
          </unload>
      </nasal>
  </canvas>
  </PropertyList>
