简体   繁体   中英

How to display a tooltip when mouse is hovered on a list item?

I want to display tooltip text whenever I hover the mouse on SWT List. When I was surfing on the internet, I found a listener MouseTrackListner and to override mouseHover() method.

But how will I get the text of the list when I hover on any item in the list?

The SWT List does not have the concept of a tooltip per item. Only a tooltip for the entire control can be set. And the position of that tooltip is not related to the currently hovered over or selected item.

As Greg suggested, you should use a TableViewer and use the ColumnViewerToolTipSupport .

See here for more information about TableViewer tooltips: ColumnViewerTooltipSupport in SWT

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM