Bug 341865 - TreeColumn.getWidth() returns 0 for unrealized column
Summary: TreeColumn.getWidth() returns 0 for unrealized column
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: helpwanted
Depends on:
Blocks: 341447
  Show dependency tree
 
Reported: 2011-04-05 02:25 EDT by Dani Megert CLA
Modified: 2019-11-12 09:46 EST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dani Megert CLA 2011-04-05 02:25:30 EDT
3.7 M6.

TreeColumn.getWidth() returns 0 for an unrealized tree column. This is not mentioned in the Javadoc and hence one could expect that:
    setWidth(w) ==> w == getWidth().

Either we fix getWidth() or improve the Javadoc. In the latter case one needs additional API that allows to tell whether the column was realized or not since testing getWidth() == 0 is not OK as the column could indeed be 0. Such an API would actually be useful on any widget.
Comment 1 Lars Vogel CLA 2019-11-12 08:14:02 EST
ExtendedMarkersView, has the following workaround due to this bug:

viewer.getTree().addPaintListener(new PaintListener() {
			@Override
			public void paintControl(PaintEvent e) {
				treePainted= true;
				viewer.getTree().removePaintListener(this);
			}
		});
Comment 2 Eric Williams CLA 2019-11-12 08:59:22 EST
Is this a Linux issue or does it happen on all platforms?
Comment 3 Lars Vogel CLA 2019-11-12 09:20:23 EST
(In reply to Eric Williams from comment #2)
> Is this a Linux issue or does it happen on all platforms?

Don't know.
Comment 4 Paul Pazderski CLA 2019-11-12 09:43:55 EST
(In reply to Eric Williams from comment #2)
> Is this a Linux issue or does it happen on all platforms?

How do I test this? I disabled the workaround in ExtendedMarkersView and saw no getWidth() == 0 on Windows 7.
Also in Snippet170 column1.getWidth() always returns 200. No matter if immediately after setWidth before or after shell open or in tree paint listener.
Comment 5 Lars Vogel CLA 2019-11-12 09:46:13 EST
Maybe this has been fixed in the last 7 years?