I'm trying to create a demonstration in Mathematica where a checkbox will show an answer, but I only want the answer to be shown while the mouse button is pressed. There seems to be a "Momentary"
option, but I can't figure out how it's used.
Checkbox[Momentary -> True]
seems to do what I want, but I need it in the Manipulate
function.
Here's a simple example of what I'm trying to do:
Manipulate[
ToString[x] <> " + " <> ToString[y] <> " = " <> If[a, ToString[x + y], ""],
{x, 1, 10, 1},
{y, 1, 10, 1},
{{a, False}, {True, False}, Momentary -> True}]
Doesn't work as I want. Replacing the last line with any of the following
{{a, False}, {True, False}, CheckboxBoxOptions -> {Momentary -> True}}]
or
Control[{{a, False}, {True, False}, Momentary -> True}]]
or
Control[{{a, False}, {True, False}, CheckboxBoxOptions -> {Momentary -> True}}]]
doesn't do it either.
The documentation is very light in how Checkbox
options are to be used.
Any ideas?
Option
from? It does not seem to work standaloneCheckbox[Dynamic@x, Momentary -> True]
. $\endgroup$