Bug 302725 - [win32] Table images in columns > 0 are not positioned correctly
Summary: [win32] Table images in columns > 0 are not positioned correctly
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows All
: P3 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2010-02-12 10:48 EST by Grant Gayed CLA
Modified: 2020-02-07 08:18 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 Grant Gayed CLA 2010-02-12 10:48:16 EST
- observed on Windows 2000 and Vista, happens in at least 3.5.2 (not sure about earlier than this) and the latest 3.6 stream

- run the snippet below
- note that the image shows fine in the first column, but in the second column its left edge is missing
  -> this looks worse with images that are more elaborate than the empty circle that's used in the snippet

public static void main (String [] args) {
	Display display = new Display();
	Image image = new Image(display, 16, 16);
	GC gc = new GC(image);
	gc.drawOval(0, 0, 15, 15);
	gc.dispose();
	Shell shell = new Shell(display);
	shell.setLayout(new FillLayout());
	Table table = new Table(shell, SWT.NONE);
	table.setLinesVisible(true);
	new TableColumn(table, SWT.NONE);
	new TableColumn(table, SWT.NONE);
	new TableColumn(table, SWT.NONE);
	TableItem item = new TableItem(table, SWT.NONE);
	item.setImage(0, image);
	item.setImage(1, image);
	item.setText(2, "text");
	for (int i=0; i<3; i++) {
		table.getColumn(i).pack ();
	}	
	shell.pack();
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) display.sleep();
	}
	image.dispose();
	display.dispose();
}
Comment 1 Thomas Haskes CLA 2010-12-07 08:16:19 EST
Still nothing here? Am I really te only one that uses images in a column other than the first? Pretty frustrating though, as I think, that fix should not be so difficult. Is there any chance this could be adressed for 3.7?
Comment 2 Felipe Heidrich CLA 2010-12-07 11:45:23 EST
(In reply to comment #1)
> Still nothing here? Am I really te only one that uses images in a column other
> than the first? Pretty frustrating though, as I think, that fix should not be
> so difficult. Is there any chance this could be adressed for 3.7?

We are very busy this time around and we are trying our best to fix as many bugs as we can. Any contribution we can get from the community is much appreciate.

I suspect this problem in the platform (it is windows that is drawing that image, not SWT). As far as fixing this problem goes the only options that come to my mind are:
1) use custom draw to draw the images ourselves
2) create a transparent image one pixel wider, draw the image to this new image at 1,0 and set that in the table item.

Both options are bad IMO.

You mention that this should not be so difficult to fix: do you have a suggestion for a fix that you would like to share ?
Comment 3 Thomas Haskes CLA 2010-12-08 04:21:39 EST
I agree. I did not know that windows is drawing the image, that makes things more complicated. Honestly I do not have suggestion, I just thought due to the fact that the lines of the table overdraw the leftmost pixel (it only happens when setLinesVisible is true) the problem lies in the calculation of how wide the columns have to be when lines are drawn. It seems to me that it was only forgotten that a column that has a vertical line on the left has to have a horizontal size that is just one pixel wider.

Anyway, I did not want to sound pretentious, just thought that this bug somehow was lost, so I thougth I'd give it a little push. However its not preventing us from using SWT, it just looks awful :-). For now I think we will just adjust our icons to have a one pixel transparent line at the left. But still af fix would be greatly appreciated, because changing every used icon is annoying.
Comment 4 Felipe Heidrich CLA 2010-12-08 10:29:20 EST
Hi Thomas, keep pushing for the bugs you need fix.

If this was something easy I'd have fixed it for you yesterday. Unfortunately we could find a good fix for the problem yet. I'll try to prove this is a bug in Windows (writing a PI snippet).
Comment 5 Tim Moore CLA 2011-09-02 06:35:38 EDT
We had a similar problem using a TableViewer with column headers, except that our guidelines are - for some reason - only 1 pixel thick (those in the attached test are to 2 pixels thick) which results in the whole icon rendering but with no margin on the left side.

The icon in the first column appears to have a margin on the left side (even if the table cell doesn't have one?). Could/shouldn't the icons in other columns also have a margin?
Comment 6 Niraj Modi CLA 2017-07-12 05:31:11 EDT
Problem reproducible on Win7.
Comment 7 Eclipse Genie CLA 2020-02-07 08:18:18 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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.

--
The automated Eclipse Genie.