Canvas GUI: Difference between revisions

Jump to navigation Jump to search
m
Use Nasal highlighter
m (Update forum links)
m (Use Nasal highlighter)
Line 93: Line 93:
Instead of embedding all code inline, you can also include an external Nasal by using:
Instead of embedding all code inline, you can also include an external Nasal by using:


<syntaxhighlight lang="php">
<syntaxhighlight lang="nasal">
io.load_nasal( getprop("/sim/fg-root") ~ "/Nasal/canvas/widgets/loglist.nas" );
io.load_nasal( getprop("/sim/fg-root") ~ "/Nasal/canvas/widgets/loglist.nas" );
</syntaxhighlight>
</syntaxhighlight>


To implement the widget-specific logic, you can access the parent canvas using the '''cmdarg()''' API:
To implement the widget-specific logic, you can access the parent canvas using the '''cmdarg()''' API:
<syntaxhighlight lang="php">
<syntaxhighlight lang="nasal">
var my_canvas = canvas.get( cmdarg() ); # this will get a handle to the parent canvas 
var my_canvas = canvas.get( cmdarg() ); # this will get a handle to the parent canvas 


Navigation menu