【发布时间】:2015-02-27 19:08:51
【问题描述】:
我有一个TableViewer 和一个ComboBoxCellEditor。当我单击单元格时,首先会看到一个文本框(类似于TextCellEditor),旁边有一个箭头。如果我单击箭头,我会得到包含我输入的值的下拉列表。
有什么方法可以让我跳过文本框步骤吗?我希望它在我单击/遍历单元格时立即打开组合框。与此密切相关的是,除了列表中的选项之外,我也不想允许任何选项。
我认为这种行为可能是由样式控制的,但我发现的唯一样式是
/**
* The list is dropped down when the activation is done through the mouse
*/
public static final int DROP_DOWN_ON_MOUSE_ACTIVATION = 1;
/**
* The list is dropped down when the activation is done through the keyboard
*/
public static final int DROP_DOWN_ON_KEY_ACTIVATION = 1 << 1;
/**
* The list is dropped down when the activation is done without
* ui-interaction
*/
public static final int DROP_DOWN_ON_PROGRAMMATIC_ACTIVATION = 1 << 2;
/**
* The list is dropped down when the activation is done by traversing from
* cell to cell
*/
public static final int DROP_DOWN_ON_TRAVERSE_ACTIVATION = 1 << 3;
它们似乎并不相关。事实上,我设置了所有这些,但我无法获得我正在寻找的功能。
如何在没有随附文本框的情况下显示 Dropbox?
【问题讨论】:
-
@MadProgrammer 谢谢。但我正在使用 swt 类。
ComboBoxCellEditor使用CCombo。不过,这是个好主意。我正在检查它是否有任何我可以使用的方法。
标签: java eclipse swt tablecelleditor tableviewer