I have a Grid
and need to enable some actions on individual values. For this I want to use an ActionMenu
that shows on right-click of the grid cell.
This should behave just as the normal right-click menu.
On a selection being made the action would evaluate and the ActionMenu
would disappear.
On clicking anywhere off of the ActionMenu
it would disappear.
I am stuck on the first part of showing the ActionMenu
. I know I need to use CurrentValue["MousePosition"]
to position it but am not certain how to do this or how to get it to disappear.
A minimal Grid
example is below.
Grid@MapIndexed[
EventHandler[
#1,
{{"MouseClicked", 2} :>
ActionMenu["Action List", {"Value" :> Echo@#1, "Index" :> Echo@#2}]}
] &,
Partition[Range[4], 2],
{2}
]
Ideas?