Tooltips, two ways to use them. Which one?


#1

Hi everybody,
What is the best solution to create tooltips ?
In a file, I have a lot of [NB1:NB2] and I’d like to show a tooltip whenever the mouse is hover [NB1:NB2] and displays the result of NB2-NB1 in the tooltip.

First solution:
I can read all the text file (the best way for me because I want to process only at saving) and create Marker. I can set a background/border color.
With this way, I don’t know how to create tooltip on mouse hover.
The Marker create a simple empty box div

<div class="highlights">
   <div class="highlight crochet_nb_bits">
      <div class="region" style="box-sizing: border-box; top: 95px; left: 42px; width: 56px; height: 19px;"></div>
   </div>
</div>

Maybe it’s possible to add a div around the text I want instead of using Marker.

Second solution:
Thanks to language-geant4-macro, I found another (easiest?!) solution by using event mousemove but this package is using the grammar to get the data (by using the div class of the hovered text).
Since I’m using Marker to highlight the [12:4], there is no DOM (only the empty div of the Marker but it seems it’s not catched by the mousemove event.

1- On Mouse Hover, want to show a tooltip displaying text depending on the value/text hovered.
2- I cannot use grammar, I have other functions to set which texts/parts can show a tooltip/be hovered.

Maybe my use of Marker is totally wrong.

Thank you.