229
edits
| Line 16: | Line 16: | ||
sk.addSkin("/foo/osc2.png"));</syntaxhighlight> | sk.addSkin("/foo/osc2.png"));</syntaxhighlight> | ||
=== | === listen_mouse_events: func(caller, Hots) === | ||
: | : '''Hots''' as vector of hashes as: <br /> | ||
''' | * {type:"click", x:<''x''>, y:<''y''>, action:<''action''>, tol:<''tol''>, parms:<''parms''> } | ||
''' | * {type:"wheel", x:<''x''>, y:<''y''>, action:<''action''>, tol:<''tol''> } | ||
: e.g. <syntaxhighlight lang="nasal">var | * {type:"cursor", x:<''x''>, y:<''y''>, style:<''style''>, tol:<''tol''>, tip:<''tipText''> } | ||
* {type:"tip", x:<''x''>, y:<''y''>, text:<''tipText''>, tol:<''tol''> } | |||
sk. | : where ''x'' and ''y'' are the local coords of the hotspot. | ||
</syntaxhighlight> | ::: ''action'' (as string) is a function. The event will call the '''''caller['action']''''' method. | ||
::: ''tol'' is the tolerance, the hotspot radious. | |||
::: ''parms'' (as vector, scalar or nil) will be passed to ''caller.action()'' as arguments. | |||
::: ''style'' (as string) is the cursor style to be used over the hotspot. | |||
::: ''tipText'' is the string to be shown over the hotspot. Use an empty string for none. | |||
<br /> | |||
: e.g. (borrowed from Oscilloscope) <syntaxhighlight lang="nasal">var wheelHots = [ | |||
{type:'wheel', x:417, y:82, action:'set1Gain', tol:12 }, | |||
{type:'cursor', x:417, y:82, style:'hand', tol:12, tip:'Ch-1 Gain' }, | |||
{type:'click', x:427, y:82, action:'set1Gain', tol:6 , parms:1 }, | |||
{type:'click', x:403, y:82, action:'set1Gain', tol:6 , parms:-1 },... | |||
]; | |||
me.sk.listen_mouse_events(caller:me, Hots:Hots);</syntaxhighlight> | |||
== Members == | == Members == | ||
edits