| Summary: | [table] [SWT.CHECK] SWT.CHECK on a table does not behave consistently | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Ketan Padegaonkar <KetanPadegaonkar> |
| Component: | SWT | Assignee: | Scott Kovatch <skovatch> |
| Status: | RESOLVED FIXED | QA Contact: | Silenio Quarti <Silenio_Quarti> |
| Severity: | normal | ||
| Priority: | P3 | CC: | alexey.v.romanov, grant_gayed, skovatch, vivek.prahlad |
| Version: | 3.5 | ||
| Target Milestone: | 3.7 M2 | ||
| Hardware: | Macintosh | ||
| OS: | Mac OS X | ||
| Whiteboard: | |||
This certainly looks bad. I'll see what I can do for 3.6.1. The behavior right now is the same on Cocoa and Carbon. The checkbox is in its own column with no label. Grant would know for sure, but I think this is just a platform difference. Yes this is a result of the checkbox needing its own physical column on OS X. This is a valid platform difference, it's not spec'd whether checkboxes are included as part of logical column 0 or not. To assume that a column's title would span outside of the column it's set in is not valid. Unless Cocoa/Carbon provide a way for the checkbox to share physical column 0, this seems like a wontfix. (In reply to comment #3) > Unless Cocoa/Carbon > provide a way for the checkbox to share physical column 0, this seems like a > wontfix. Looking at Table, this actually wouldn't be too hard to do in Cocoa. Just set the title of the NSButtonCell to be the string value of logical column 0, and return the checked/grayed state as the value for column 0. No need for a separate check column. If this is important I can aim to fix it in 3.7. If it's not too complicated then sure, this can be done on Cocoa. There are a few places in Table and Tree where a column index is incremented or decremented iff SWT.CHECK is specified, to account for checkboxes having their own column. These cases could probably go away then. Targeting for 3.7. We will not be fixing this for Carbon; I'm not sure if it can even be done. Fixed > 20100817. It wasn't as invasive as I had expected -- just needed to expand the first data column to cover the checkbox area. . |
A table with SWT.CHECK does not render the column label correctly. On a macosx/carbon, the first column header("foo") appears on the second column which is not the checkbox. On gtk and even win32, the column "foo" is the same as column as the checkbox. Testcase: public class Main { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout(1, false)); Table table = new Table(shell, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.HIDE_SELECTION | SWT.H_SCROLL | SWT.CHECK); table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); table.setLinesVisible(true); table.setHeaderVisible(true); TableColumn tableColumn = new TableColumn(table, SWT.LEAD); tableColumn.setText("foo"); TableColumn tableColumn2 = new TableColumn(table, SWT.LEAD); tableColumn2.setText("bar"); TableColumn tableColumn3 = new TableColumn(table, SWT.LEAD); tableColumn3.setText("baz"); new TableItem(table, SWT.NONE).setText(new String[]{ "cell-1-1", "cell-1-2", "cell-1-3"}); new TableItem(table, SWT.NONE).setText(new String[]{ "cell-2-1", "cell-2-2", "cell-2-3"}); for (int i = 0; i < table.getColumnCount(); i++) { table.getColumn(i).pack(); } shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); } }