I have a problem, that is I want to use loop to create multiple EventHandlers,
but my code shows nothing. What can I do?
DynamicModule[{i, pos10 = {{}, {}}, pos11 = {{0, 0, 0}, {0, 0, 0}},
pos12 = {{0, 0, 0}, {0, 0, 0}}, pos20,
pos21 = {{0, 0, 0}, {0, 0, 0}}, pos22 = {{0, 0, 0}, {0, 0, 0}}},
Graphics3D[{
For[i = 1, i <= 2, i++,
Print[i];
EventHandler[
Dynamic[{Translate[Cuboid[], pos11][[i]]}, ImageSize -> Tiny]
,
{"MouseDown" :> {(pos10[[i]] = Mean@MousePosition["Graphics3DBoxIntercepts"])},
"MouseDragged" :> (pos11[[i]] = pos12[[i]] + Mean@MousePosition["Graphics3DBoxIntercepts"] -
pos10[[i]]),
"MouseUp" :> (pos12 = pos11)}];
]},
PlotRange -> {{-3, 3}, {-3, 3}, {-3, 3}}]]
Table. 3. But evenTable[ stuff; {..}]will give you nothing (Null) so skip;. More in What are the most common pitfalls awaiting new users?