SWT TableCombo禁用所选项目的突出显示 [英] SWT TableCombo disable highlighting of selected item

查看:63
本文介绍了SWT TableCombo禁用所选项目的突出显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 TableCombo ,当我按下下拉按钮时,显示所有项目的列表.我想实现当前选中的行不在此列表中突出显示(因为我根据项目类型使用不同的背景颜色,而突出显示隐藏了所选项目的背景颜色).我尝试使用SWT.NO_FOCUSSWT.HIDE_SELECTION标志创建表,但未删除突出显示.有任何想法吗?

I am using TableCombo and when I push the dropdown button, the list of all items is shown. I would like to achieve that currently selected row is not highlighted in this list (because I use different background colors depending on type of item and the highlight hides the background color of selected item). I have tried creating the table with SWT.NO_FOCUS and SWT.HIDE_SELECTION flags, but it did not remove the highlight. Any ideas?

我试图找出类似荧光笔的东西,但是我没有成功

I have tried to find out something like highlighter in swing, but I haven't succeed

推荐答案

我刚刚发现

I just found this thread, which pretty much answers my question. For SWT.FULL_SELECTION highlighting is taken care of by OS automatically - see Table.CDDS_ITEMPOSTPAINT(NMLVCUSTOMDRAW nmcd, int wParam, int lParam) on Win32.

但是,可以通过样式常量来修改此行为.对我来说正确的解决方案是同时使用SWT.FULL_SELECTION(可以选择整行)和SWT.NO_FOCUS(不使用深蓝色突出显示)和SWT.HIDE_SELECTION(为所选项目隐藏默认的灰色背景颜色)标记.

However this behavior can be modified by style constants. Correct solution for me was using SWT.FULL_SELECTION (whole row can be selected) and SWT.NO_FOCUS (dark blue highlight is not used) and SWT.HIDE_SELECTION (hides default gray background color for selected item) flags together.

遗憾的是,SWT Tree不支持HIDE_SELECTION标志.

Sadly, the HIDE_SELECTION flag is not supported by SWT Tree.

这篇关于SWT TableCombo禁用所选项目的突出显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆