Skinnable canvas window: Difference between revisions

Jump to navigation Jump to search
no edit summary
No edit summary
Line 6: Line 6:
'''size''' mandatory as [''width, height''] vector, the window dimension.<br />
'''size''' mandatory as [''width, height''] vector, the window dimension.<br />
'''title''' optional as string , the window title. Empty by default.<br />
'''title''' optional as string , the window title. Empty by default.<br />
: e.g.  <pre style="color: green"> var sk = canvas.skinnable.new([575,290]);</pre>
: e.g.  <syntaxhighlight lang="nasal"> var sk = canvas.skinnable.new([575,290]);</syntaxhighlight>


== Methods ==
== Methods ==
Line 13: Line 13:
: loads the image file and creates Canvas Image element.
: loads the image file and creates Canvas Image element.
'''filename''' as the absolute file path. The file must be a .png or a .jpg image.
'''filename''' as the absolute file path. The file must be a .png or a .jpg image.
: e.g. <pre style="color: green">var sk = canvas.skinnable.new([575,290]);
: e.g. <syntaxhighlight lang="nasal">var sk = canvas.skinnable.new([575,290]);
sk.addSkin("/foo/osc2.png"));</pre>
sk.addSkin("/foo/osc2.png"));</syntaxhighlight>


=== listen_mouse_clicks: func(object, function) ===
=== listen_mouse_clicks: func(object, function) ===
Line 20: Line 20:
'''object''' as the calling object.<br />
'''object''' as the calling object.<br />
'''function''' as the callback function.<br />
'''function''' as the callback function.<br />
: e.g. <syntaxhighlight lang="nasal">sk.addSkin("/foo/osc2.png"));
: e.g. <syntaxhighlight lang="nasal">var sk = canvas.skinnable.new([575,290]);
me.sk.listen_mouse_clicks(object:me, function:me.onClick);
sk.addSkin("/foo/osc2.png"));
sk.listen_mouse_clicks(object:me, function:me.onClick);
</syntaxhighlight>
</syntaxhighlight>
229

edits

Navigation menu