Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 344573 - Tables and Trees without column doesn't resize width when item font changes
Summary: Tables and Trees without column doesn't resize width when item font changes
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7   Edit
Hardware: PC Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-03 09:51 EDT by Markus Keller CLA
Modified: 2019-11-14 02:17 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2011-05-03 09:51:52 EDT
I20110428-0848 Cocoa (works fine on Windows 7)

Tables and Trees without a column doesn't resize the width of the column when an item font changes.

In the SDK, the problem can show up on the API Baselines preference page.


package snippets;

import org.eclipse.swt.SWT;
import org.eclipse.swt.events.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;

public class SnippetTableWidth {
	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.CHECK | SWT.FULL_SELECTION);
		table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

		for (int i = 0; i < 5; i++) {
			TableItem item = new TableItem(table, SWT.NONE);
			item.setText("This is item number" + i);
		}

		final TableItem item0 = table.getItem(0);
		FontData[] fontData = display.getSystemFont().getFontData();
		for (int i = 0; i < fontData.length; i++)
			fontData[i].setStyle(SWT.BOLD);
		final Font boldFont = new Font(display, fontData);

		Button button = new Button(shell, SWT.PUSH);
		button.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false,
				false));
		button.setText("Toggle Bold");
		button.addSelectionListener(new SelectionAdapter() {
			boolean fBold = false;

			public void widgetSelected(SelectionEvent e) {
				fBold = !fBold;
				item0.setFont(fBold ? boldFont : null);
			}
		});

		shell.pack();
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}
}
Comment 1 Lars Vogel CLA 2019-11-14 02:17:14 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

If the bug is still relevant, please remove the "stalebug" whiteboard tag.