【问题标题】:selection in CheckboxTableViewer on win7 is not workingwin7上CheckboxTableViewer中的选择不起作用
【发布时间】:2011-12-11 19:52:29
【问题描述】:

我尝试使用 org.eclipse.jface.viewers.CheckboxTableViewer 作为 org.eclipse.jface.wizard.WizardPage 的组件。我是这样创建的:

public void createControl(Composite parent) {
    composite = new Composite(parent, SWT.NULL);
    final GridLayout gridLayout = new GridLayout();
    gridLayout.numColumns = 2;
    composite.setLayout(gridLayout);
    setControl(composite);

    /* CheckboxTableViewer */
    viewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
    final Table table = viewer.getTable();
    GridData data1 = new GridData();
    data1.grabExcessHorizontalSpace = true;
    data1.grabExcessVerticalSpace = true;
    data1.horizontalSpan = 2;
    data1.horizontalAlignment = SWT.FILL;
    data1.verticalAlignment = SWT.FILL;
    table.setLayoutData(data1);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    checkboxColumn = new TableColumn(table, SWT.LEFT);
    ...

查看器的内容由内容提供者动态插入。在 gnome 上一切正常。在 Windows 7(64 位和 32 位)上对此进行测试时,我无法选择该视图的任何条目。鼠标点击似乎对视图没有影响。 我在表格中添加了一个 mouselistener,并且触发了 mouseUp-/Down 事件,没有触发查看器上的 selectionChanged 和 doubleClick。谁能向我解释这种行为?

提前谢谢,

哈格

(我已经在 eclipse 论坛上发布了这个问题,还没有任何回应:http://www.eclipse.org/forums/index.php/t/250953/

【问题讨论】:

    标签: java eclipse windows-7 rcp jface


    【解决方案1】:

    您必须在创建 CheckboxTableViewer 时添加另一个样式标志:SWT.FULL_SELECTION

    viewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER | SWT.FULL_SELECTION);
    

    您现在可以通过单击选择表格中的行。

    【讨论】:

      猜你喜欢
      • 2017-04-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-24
      • 2013-10-24
      • 1970-01-01
      • 2020-05-01
      • 1970-01-01
      相关资源
      最近更新 更多