Re: SWT: Controls within Tables don't react well on mouse clicks
In article
<624bc5c1-10b9-4163-bbde-b0a5f4993101@z72g2000hsb.googlegroups.com>,
"tomaszewski.p" <ksswzza@gmail.com> wrote:
On 11 Wrz, 10:05, Peter M?ller <u...@example.net> wrote:
[...]
I use Java is 1.5.0_13. The operating system is Mac OS X 10.5.4 (PPC).
I've launched your code (as snippet, not in eclipse) on
Windows Vista
Java 1.6.0_7
SWT 3.4
and I do not see any of effect you described. Unfortunately it looks
like platform dependent problem
[...]
Quite possibly. On Mac OS X 10.4.11 (PPC), Java 1.5.0_13, SWT 3.3.3, I
can't get a Combo to work normally in a Table. It looks like a font
metric problem, but I may be using it incorrectly. In contrast, a CCombo
looks and acts fine:
<sscce>
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CCombo;
import org.eclipse.swt.custom.TableEditor;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
import org.eclipse.swt.widgets.Text;
public class SWTest {
public static void main(String[] args) {
Display display = new Display();
Shell shell = new Shell(display);
shell.setLayout(new FillLayout());
Table table = new Table(shell, SWT.BORDER | SWT.MULTI);
table.setLinesVisible(true);
for (int i = 0; i < 3; i++) {
TableColumn column = new TableColumn(table, SWT.NONE);
column.setWidth(125);
}
for (int i = 0; i < 12; i++) {
new TableItem(table, SWT.NONE);
}
TableItem[] items = table.getItems();
for (int i = 0; i < items.length; i++) {
TableEditor editor = new TableEditor(table);
CCombo combo = new CCombo(table, SWT.NONE);
combo.setText("Choose \u03b1, \u03b2, \u03b3");
combo.add("Alpha");
combo.add("Beta");
combo.add("Gamma");
editor.grabHorizontal = true;
editor.setEditor(combo, items[i], 0);
editor = new TableEditor(table);
Text text = new Text(table, SWT.NONE);
text.setText("Text");
editor.grabHorizontal = true;
editor.setEditor(text, items[i], 1);
editor = new TableEditor(table);
Button button = new Button(table, SWT.CHECK);
button.pack();
editor.minimumWidth = button.getSize().x;
editor.horizontalAlignment = SWT.LEFT;
editor.setEditor(button, items[i], 2);
}
shell.pack();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
</sscce>
--
John B. Matthews
trashgod at gmail dot com
home dot woh dot rr dot com slash jbmatthews