2
$\begingroup$

I want to extract the Graphics type when I hover my mouse over an object, but I failed to do so. Below is the code I am working on. Any suggestions are welcome

m = "E";
Graphics[{ 
  Mouseover[ {Black, Disk[{-10, 0}]}, {m = "D"; Red, Disk[{-10, 0}]}],
  Mouseover[ {Black, Rectangle[{10, 0}]}, {m = "R"; Red, 
    Rectangle[{10, 0}]}]
  ,  Text[Dynamic[m], {0, 0}]
  }]
$\endgroup$
1
  • $\begingroup$ Have a look at Annotation, it appears that fits what you're trying to do. $\endgroup$
    – ciao
    Feb 24, 2014 at 9:25

1 Answer 1

4
$\begingroup$

Use Dynamic inside Mouseover

Graphics[{
  Mouseover[{Black, Disk[{-10, 0}]}, Dynamic[{m = "D"; Red, Disk[{-10, 0}]}]],
  Mouseover[{Black, Rectangle[{10, 0}]}, Dynamic[{m = "R"; Red, Rectangle[{10, 0}]}]],
  Dynamic@Text[m, {0, 0}]
  }, ImageSize -> 400]

enter image description here

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.