I have a StandardForm expression
Is it possible to add an event listener to the variables, parentheses, and plus signs so that when I click them their color changes for example. Maybe it would be somehow possible to get the box dimensions and locations for each of these elements. Here I've highlighted the box for b by selecting it:
I tried this but it didn't work.
ToBoxes[(a + b) c^d + p]
RowBox[{RowBox[{RowBox[{"(", RowBox[{"a", "+", "b"}], ")"}], " ", SuperscriptBox["c", "d"]}], "+", "p"}]
ToExpression[
RowBox[{RowBox[{RowBox[{"(",
RowBox[{EventHandler[
"a", {"MouseClicked" :> (thing = "clicked")}], "+", "b"}],
")"}], " ", SuperscriptBox["c", "d"]}], "+", "p"}]]
$Failed
I also tried this but it didn't work either.
EventHandler["(", {"MouseClicked" :> (thing = "clicked")}]
EventHandler["a", {"MouseClicked" :> (thing = "clicked")}]
EventHandler["+", {"MouseClicked" :> (thing = "clicked")}]
EventHandler["b", {"MouseClicked" :> (thing = "clicked")}]
EventHandler[")", {"MouseClicked" :> (thing = "clicked")}]
The elements of the expression are in wrong order.
Any ideas on new approaches?