|
| |
| Navigation |
Synopsis Define interactive behaviour when mouse is pressed while mouse is over figure.
Function
FProperty onMouseDown(bool (int, map[KeyModifier,bool]) cb)
Description
onMouseDown has a single argument: a callback cb that gets two arguments:
bool which indicates if the event is captured. Mouse handlers are executed deepest-figure first, if the mouse press is captured then the mouse press is not propagated further so figures below (less deep than) this figure will not receive a mouse press.
Examples
import vis::KeySym;
s = "";
s2 = "";
b = box(text(str () { return s; }),
fillColor("red"),
onMouseDown(bool (int butnr, map[KeyModifier,bool] modifiers) {
s = "<butnr>";
return true;
}));
b2 = box(vcat([
text(str () { return s2; }),
b],shrink(0.7)),
fillColor("green"),
onMouseDown(bool (int butnr, map[KeyModifier,bool] modifiers) {
s2 = "<butnr>";
return true;
}));
render(b2);
|