20,741
edits
| Line 35: | Line 35: | ||
== Full Example: Creating dialogs with embedded Canvas Maps == | == Full Example: Creating dialogs with embedded Canvas Maps == | ||
Add this to the "Nasal/open" tag of your XML dialog: | Add this to the "Nasal/open" tag of your XML dialog and customize it for your dialog: | ||
<syntaxhighlight lang="php"> | <syntaxhighlight lang="php"> | ||
## "prologue" currently required by the canvas-generic-map | |||
var dialog_name ="airports"; #TODO: use substr() and cmdarg() to get this dynamically | |||
var dialog_property = func(p) return "/sim/gui/dialogs/airports/"~p; #TODO: generalize using cmdarg | |||
var DIALOG_CANVAS = gui.findElementByName(cmdarg(), "airport-selection"); | |||
canvas.GenericMap.setupGUI(DIALOG_CANVAS, "canvas-control"); #TODO: this is not a method! | |||
## end of canvas-generic-map prologue | |||
</syntaxhighlight> | </syntaxhighlight> | ||