问题描述
我已经环顾四周,似乎无法确定这是否可行.
I've been looking around for ages and can't seem to find whether this is possible or not.
我有一个 Combo 小部件填充了一些字符串,并且不想将工具提示文本设置为 Combo 小部件中每个项目的不同内容.即,当您将鼠标悬停在组合小部件中的某个项目上时,鼠标图标上方会显示一个字符串.
I have a Combo widget populated with some strings and wan't to set the tool tip text to be something different for each item in the Combo widget. i.e. When you mouse over an item in the Combo widget a string is displayed above the mouse icon.
例如,如果 Combo 小部件中有 2 个项目,Foo 和 Bar,您能否将鼠标悬停在 Foo 上时的工具提示文本设置为Foo",将鼠标悬停在 Bar 上时设置为Bar"?
For example if there are 2 items in the Combo widget, Foo and Bar, can you set the tool tip text to be "Foo" when you mouse over Foo and "Bar" when you mouse over Bar??
任何建议/见解都会很棒,谢谢!
Any advice/insights would be great, thanks!
推荐答案
Edward Thomson 的解决方案可能是最好的解决方案,但如果您不想编码,您可以使用 博客文章为 SWT 启用工具提示的 CCombo(风险自担).
The solution by Edward Thomson is probably the best one, but if you don't want to code, you might use TooltipCCombo class from blog post Tooltip enabled CCombo for SWT (at your's own risk).
这篇关于为 SWT Combo 小部件中的每个元素设置工具提示文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!