Community
Participate
Working Groups
3.1RC1, using gtk 2.4.13 - run the snippet below (substituting Tree* for Table* shows similar behaviour) - drag the visible column separator to the right (ie.- make column 0 wider) - now click on the shell, and the Table's background is set to red -> but for some reason this also reduces the width of column 0 to close to 0 public static void main(String[] args) { final Display display = new Display(); final Shell shell = new Shell(display); shell.setBounds(10,10,400,400); final Tree tree = new Tree(shell, SWT.NONE); tree.setBounds(10,10,300,300); tree.setHeaderVisible(true); new TreeColumn(tree, SWT.NONE).setWidth(20); new TreeColumn(tree, SWT.NONE).setWidth(20); new TreeItem(tree, SWT.NONE).setText(new String[] {"column 0","column 1"}); shell.open(); shell.addListener(SWT.MouseDown, new Listener() { public void handleEvent(Event event) { tree.setBackground(display.getSystemColor(SWT.COLOR_RED)); } }); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }
Note that Table/TreeColumn.setAlignment() also does this. To see this case, change the comment 0 snippet: - create a third column: add "new TreeColumn(tree, SWT.NONE).setWidth(20);" - change the listener callback to: "tree.getColumn(1).setAlignment(SWT.RIGHT);"
Not yet reproducable using GTK+ 2.6.4.
However, it is reproducable using GTK+ 2.2.4.
This is not a recent regression, it is reproducable on 3.0.1 as well using a Table. I believe this is the change in GTK+ which fixed it in versions 2.6.0 and higher: Mon Nov 15 14:25:21 2004 Jonathan Blandford <jrb@redhat.com> * gtk/gtktreeviewcolumn.c (_gtk_tree_view_column_cell_set_dirty): Patch from Gavin Romig-Koch <gavin@redhat.com> to no longer reset the resized_width when marking a column dirty.
Bogdan, this seems to be fixed in latest at least in gtk 2.8.x.
The old GTK2 version is no longer supported and backgrounds for Table/Trees is CSS based now anyways. Closing.