Reputation: 35
The exact already asked question to what I'd like to do is: how to add tooltip on the entries and not the combo....
I cannot use a CCombo
. JoeYo said that he solved it by using a DefaultToolTip
class on the Combo
, but he didn't elaborate.
Can anyone, (@JoeYo hopefully) give me a bit more detail how to got the handle on the list, once dropped, to capture the mouse hover events, and then of course display the tool tip?
If I was supposed to ask for more info on the original question, I could not figure out how. I tried to comment, but was told I did not have enough credits.
Upvotes: 2
Views: 963
Reputation: 21025
DefaultToolTip
is part of JFace. Other than the native tooltip of the platform, it can be freely positioned and shown/hidden. Internally it is comprised of a Shell
that when shown stays on top of all other controls.
In combination with a MouseListener
, the getVisibleItemCount()
and getItemHeight
you might be able to compute above which item (if any) the mouse cursor hovers and show a tooltip with suitable content.
This answer has a snippet that computes which item of a List
widget is under the mouse pointer. It should be possible to adapt it for the Combo
widget. The remaining difficulty is probably to figure out the of the drop-down and the gap between of the Combo and its drop-down.
Upvotes: 1