Skip to main content
added 5 characters in body
Source Link
Sjoerd C. de Vries
  • 66.2k
  • 15
  • 189
  • 327

This is a job for EventHandler:

EventHandler[
   Slider2D[Dynamic[{x, y}], {{0, 0}, {5, 8}, {1, 2}}],
   {"MouseUp" :> AppendTo[datalist, {x, y}]},
   PassEventsDown -> True
]

Mathematica graphics

Follow the data acquisition with a Dynamic:

Dynamic[datalist]

{{1,1},{3,4},{2,2},{2,4}}

PassEventsDown -> True is necessary to prevent EventHandler to eatfrom eating up the MouseDrag events that are necessary to make the Slider2D move. To let Slider2D update x and y the Dynamic is necessary. This is well documented in the Slider2D documentation.

This is a job for EventHandler:

EventHandler[
   Slider2D[Dynamic[{x, y}], {{0, 0}, {5, 8}, {1, 2}}],
   {"MouseUp" :> AppendTo[datalist, {x, y}]},
   PassEventsDown -> True
]

Mathematica graphics

Follow the data acquisition with a Dynamic:

Dynamic[datalist]

{{1,1},{3,4},{2,2},{2,4}}

PassEventsDown -> True is necessary to prevent EventHandler to eat up the MouseDrag events that are necessary to make the Slider2D move. To let Slider2D update x and y the Dynamic is necessary. This is well documented in the Slider2D documentation.

This is a job for EventHandler:

EventHandler[
   Slider2D[Dynamic[{x, y}], {{0, 0}, {5, 8}, {1, 2}}],
   {"MouseUp" :> AppendTo[datalist, {x, y}]},
   PassEventsDown -> True
]

Mathematica graphics

Follow the data acquisition with a Dynamic:

Dynamic[datalist]

{{1,1},{3,4},{2,2},{2,4}}

PassEventsDown -> True is necessary to prevent EventHandler from eating up the MouseDrag events that are necessary to make the Slider2D move. To let Slider2D update x and y the Dynamic is necessary. This is well documented in the Slider2D documentation.

Source Link
Sjoerd C. de Vries
  • 66.2k
  • 15
  • 189
  • 327

This is a job for EventHandler:

EventHandler[
   Slider2D[Dynamic[{x, y}], {{0, 0}, {5, 8}, {1, 2}}],
   {"MouseUp" :> AppendTo[datalist, {x, y}]},
   PassEventsDown -> True
]

Mathematica graphics

Follow the data acquisition with a Dynamic:

Dynamic[datalist]

{{1,1},{3,4},{2,2},{2,4}}

PassEventsDown -> True is necessary to prevent EventHandler to eat up the MouseDrag events that are necessary to make the Slider2D move. To let Slider2D update x and y the Dynamic is necessary. This is well documented in the Slider2D documentation.