Howto:Prototyping a new NavDisplay Style: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 408: Line 408:
  }
  }
  },
  },
</syntaxhighlight>
{{Note|navdisplay.mfd around line 270, the clip options must be embedded into 'rect()' }}
<syntaxhighlight lang="diff">
me.map = me.nd.createChild("map","map")
.set("clip", "rect("~map_rect~")")
.set("screen-range", 700);
</syntaxhighlight>
</syntaxhighlight>


Line 455: Line 461:
{{Note|The following code will no longer work without the changes shown above, if in doubt, see the history of this article  for the previous version. For testing purposes, put the following dialog into $FG_ROOT/gui/dialogs/canvas-nd.xml and use the [[Nasal Console]] to run the dialog (or extend the [[Menubar]] accordingly):
{{Note|The following code will no longer work without the changes shown above, if in doubt, see the history of this article  for the previous version. For testing purposes, put the following dialog into $FG_ROOT/gui/dialogs/canvas-nd.xml and use the [[Nasal Console]] to run the dialog (or extend the [[Menubar]] accordingly):
<syntaxhighlight lang="nasal">fgcommand('dialog-show', props.Node.new({'dialog-name':'canvas-nd'}) );</syntaxhighlight>
<syntaxhighlight lang="nasal">fgcommand('dialog-show', props.Node.new({'dialog-name':'canvas-nd'}) );</syntaxhighlight>
}}
{{Note|The following can be split into a XML file and a nasal file - makes editing and syntax highlighting easier. However, variables used in the close block must be declared in the open block before the include of the nasal file.
}}
}}


Line 627: Line 636:
   <nasal>
   <nasal>
   <open><![CDATA[
   <open><![CDATA[
# to be used for shutting down each created instance upon closing the dialog (see the close block below)
# variable not visible in close block, if defined in included nasal file, so defined here
var MFDInstances = {};
#io.include("canvas-nd-dlg-open.nas");
### optional: move everything below this line up to end of CDATA to a separate nas file and include it (uncomment the line above)
var getWidgetTemplate = func(root, identifier) {
var getWidgetTemplate = func(root, identifier) {
var target = globals.gui.findElementByName(root,  identifier );
var target = globals.gui.findElementByName(root,  identifier );
Line 842: Line 856:
#print("Complete dialog is:");
#print("Complete dialog is:");
#props.dump( WidgetTemplates['canvas-placeholder'] );
#props.dump( WidgetTemplates['canvas-placeholder'] );
### end of nasal code to be moved
   ]]>
   ]]>
   </open>
   </open>
252

edits

Navigation menu