Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 97715 - setting Table/Tree background can reset column width
Summary: setting Table/Tree background can reset column width
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux-GTK
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Bogdan Gheorghe CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-31 16:29 EDT by Grant Gayed CLA
Modified: 2016-08-28 05:18 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Grant Gayed CLA 2005-05-31 16:29:06 EDT
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();
}
Comment 1 Grant Gayed CLA 2005-06-01 10:12:15 EDT
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);"
Comment 2 Billy Biggs CLA 2005-06-01 21:35:09 EDT
Not yet reproducable using GTK+ 2.6.4.
Comment 3 Billy Biggs CLA 2005-06-02 09:43:37 EDT
However, it is reproducable using GTK+ 2.2.4.
Comment 4 Billy Biggs CLA 2005-06-03 16:23:19 EDT
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.
Comment 5 Silenio Quarti CLA 2007-04-27 17:13:24 EDT
Bogdan, this seems to be fixed in latest at least in gtk 2.8.x.
Comment 6 Eric Williams CLA 2016-07-29 14:14:18 EDT
The old GTK2 version is no longer supported and backgrounds for Table/Trees is CSS based now anyways. Closing.