I am using SWT's StyledText and I am wondering how I would detect if the user hovers over a word for more then 3 seconds. An example of what I mean is how Eclipse has a popup that shows, when you hover over a text.
How to show a hover popup with SWT StyledText
643 Views Asked by ThePrimedTNT At
3
There are 3 best solutions below
0
On
While you can implementet text hover yourself, with a MouseTrackListener like suggested by Greg, you can also use the JFace TextViewer.
The TextViewer provides a higher-level abstraction for text hover. With its setTextHover() methods you can set a callback, that is informed when a text hover for a certain region should be shown.
This is also the method that is used by Eclipse text editors.
You can use a 'mouse track listener' to listen for mouse hover events. However you can't set the hover time for this:
MouseTrackListenerhas three events -mouseEnter,mouseExitandmouseHover.