The widget below is just a toy that I put together so that I could ask this question.
DynamicModule[
{c = {0, 0}, a = 1, da = 0.1, digits},
digits = -Round[Log10[FractionalPart[da]]];
Manipulate[
Graphics[
GeometricTransformation[Rectangle[c - 1, c + 1],
RotationTransform[a, c]]
, ImageSize -> Small
, AspectRatio -> Automatic
, PlotRange -> Transpose[{c - 1.5, c + 1.5}]
]
, Row[{
InputField[
Dynamic[
ToString[
NumberForm[ a
, {Infinity, digits}
, ExponentFunction -> (Null &)
]
]
, If[StringMatchQ[#, FrontEnd`Private`ValidNumberRegex],
a = ToExpression[#]] &
]
, String
, ImageSize -> 50
]
, Spacer[10]
, Button["\[DownArrow]", a -= da]
, Spacer[5]
, Button["\[UpArrow]", a += da]
}]
]
]
The widget's intended functionality is to let the user
- specify, via the input field, a "base point" value for the square's rotation angle (in radians); and then
- perturb this value in small increments, up or down, by clicking on the buttons.
(The idea is to have the functionality of an "infinite slider".)
Currently, to perturb the value by more than a single increment, one must click the appropriate button repeatedly.
Q: How can I have the value of the angle (and the square's corresponding rotation) continue to be perturbed as long as the button remains pressed?
(I imagine that it may be necessary to throttle the updates, to prevent them from happenning too rapidly.)
EDIT
I should have made clear that, for the intended functionality, it is essential that the changes in the angle be immediately reflected in the square's current rotation. IOW, while a button remains pressed, not only should the angle's numeric value change, but also the square should rotate (visibly).