I have two level EventHandler. The inner one is made of vertex of Graph and the other outer one is of the Dynamic Graph.
(1) If I select a arbitray place on the Graph except a vertex, then every thing is OK, but
(2) if I select the vertex after restart this code, then dragging process is sttoped I don't know why it is doing like this.
If I remove MouseDown of vertex eventhandler in this code, then the process is ok. but I want to make some action after vertex MouseDown. Is there something help! thank you.
DynamicModule[{vlist, elist, p, mousep, select},
vlist = EventHandler[#, {
"MouseDown" :> AppendTo[e, 1],
"MouseDragged" :> AppendTo[e, 2]}] & /@ Range[3];
elist = {1 -> 2, 2 -> 3, 3 -> 1, 1 -> 3};
p = {{-.5, -.2}, {.5, -.2}, {0, .5}};e = {};
EventHandler[
Dynamic[
Graph[vlist, elist, VertexCoordinates -> p, VertexSize -> {.15, .15},
VertexLabels -> "Name", PlotRange -> 1]],
{"MouseDown" :> (AppendTo[e, 3];
mousep = MousePosition["Graphics"];
select = Position[p, Nearest[p, mousep][[1]]][[1, 1]]),
"MouseDragged" :> (AppendTo[e, 4];
p[[select]] = MousePosition["Graphics"]),
"MouseUp" :> (Print[Short[e, 1]]; e = {})}, PassEventsDown -> True]
]