[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform.swt] Re: Checkbox appears when resizing table on Mac
|
Grant Gayed wrote:
I think it will be difficult to know what's happening without a snippet that
shows the problem. Are you able to provide one (ideal snippet template:
http://www.eclipse.org/swt/faq.php )?
Grant
"Srdan Bejakovic" <sbejakovic@xxxxxxxxx> wrote in message
news:g0h3sl$k37$1@xxxxxxxxxxxxxxxxxxxx
I created a table with columns of checkboxes, combos and other controls.
The checkboxes are in the first column. When the table is resized on a
Mac, an additional checkbox appears over the column header; this doesn't
happen on Windows. I don't know if it's relevant, but the table is also
virtual. Any ideas about what can be done about this problem?
I've attached a snippet that reproduces the problem on Mac. The table
starts out fine, as it's expanded, a checkbox appears, and as it becomes
larger the checkbox once again disappears.
package sandbox;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.TableEditor;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;
public class MacTableSnippet {
public static void main (String [] args) {
Display display = new Display ();
Shell shell = new Shell (display);
shell.setLayout(new GridLayout());
final Table table = new Table(shell, SWT.VIRTUAL | SWT.HIDE_SELECTION | SWT.BORDER);
table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
table.setLinesVisible(true);
table.setHeaderVisible(true);
table.setSize(200, 200);
table.setItemCount(50);
final TableColumn newColumnTableColumn = new TableColumn(table, SWT.NONE);
newColumnTableColumn.setWidth(50);
newColumnTableColumn.setText("Select");
table.addListener(SWT.SetData, new Listener() {
public void handleEvent(Event event) {
TableItem item = (TableItem)event.item;
TableEditor editor = new TableEditor(table);
final Button button = new Button(table, SWT.CHECK);
button.setSelection(true);
button.pack();
editor.minimumWidth = button.getSize().x;
editor.horizontalAlignment = SWT.LEFT;
editor.setEditor(button, item, 0);
}
});
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}