Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352042 - SWT Table has unfilled spaces between columns in Windows 7
Summary: SWT Table has unfilled spaces between columns in Windows 7
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.1   Edit
Hardware: PC Windows 7
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-13 21:53 EDT by rfang CLA
Modified: 2019-11-14 03:33 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description rfang CLA 2011-07-13 21:53:01 EDT
Build Identifier: 1.3.2.20110218-0812

If the Table background is set to be different from the cell background color, you'll notice that there's a 1-2px crack between two cells that are not filled with the cell background color, but instead shows the Table Background.

It looks good in XP:
<img src="http://i.stack.imgur.com/1hOyX.png" />

But bad in W7:
<img src="http://i.stack.imgur.com/rReum.png" />

If I use an SWT jar from 3-4 jars ago, the problem goes away, so it's not a Windows 7 native rendering problem, but rather some bug in the new SWT jars with how it interacts with Windows 7.


Reproducible: Always

Steps to Reproduce:
1. Create a Shell
2. Create a Table in the Shell. Set background to back
3. Create a couple of TableItems and color all cell's background to Light Blue
4. Observer the dark column dividing black lines between columns
Comment 1 rfang CLA 2011-08-17 04:03:52 EDT
How come nobody is looking into this? Or at least comment on it? Is SWT an abandoned child?
Comment 2 Felipe Heidrich CLA 2011-08-17 20:59:49 EDT
Please add a testcase, I will take a look at this problem when I return from vacation (next week). Thanks
Comment 3 rfang CLA 2011-08-17 22:10:34 EDT
Table items look perfectly white and clean in XP. columns appear to be separated by a thick black line under Windows 7.

Test Code to reproduce:

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.TableItem;

public class W7TableTest {

  Display d;

  Shell s;

  W7TableTest() {
    d = new Display();
    s = new Shell(d);

    s.setSize(250, 200);

    s.setText("A Table Shell Example");
    s.setLayout(new FillLayout());

    final Table t = new Table(s, SWT.FULL_SELECTION | SWT.VIRTUAL);

    final TableColumn tc1 = new TableColumn(t, SWT.CENTER);
    final TableColumn tc2 = new TableColumn(t, SWT.CENTER);
    final TableColumn tc3 = new TableColumn(t, SWT.CENTER);
    tc1.setText("First Name");
    tc2.setText("Last Name");
    tc3.setText("Address");
    tc1.setWidth(70);
    tc2.setWidth(70);
    tc3.setWidth(80);
    t.setHeaderVisible(true);

    final TableItem item1 = new TableItem(t, SWT.NONE);
    item1.setText(new String[] { "Tim", "Hatton", "Kentucky" });
    final TableItem item2 = new TableItem(t, SWT.NONE);
    item2.setText(new String[] { "Caitlyn", "Warner", "Ohio" });
    final TableItem item3 = new TableItem(t, SWT.NONE);
    item3.setText(new String[] { "Reese", "Miller", "Ohio" });

    final org.eclipse.swt.graphics.Color black = new org.eclipse.swt.graphics.Color(d, 0, 0, 0);
    final org.eclipse.swt.graphics.Color white = new org.eclipse.swt.graphics.Color(d, 255, 255, 255);
    item1.setBackground(white);
    item2.setBackground(white);
    item3.setBackground(white);

    t.setBackground(black);

    s.open();
    while (!s.isDisposed()) {
      if (!d.readAndDispatch()) {
		d.sleep();
	}
    }
    d.dispose();
  }

  public static void main(final String[] argv) {
    new W7TableTest();
  }

}
Comment 4 rfang CLA 2011-08-31 02:05:57 EDT
Any assessment, please? Thank you.
Comment 5 Felipe Heidrich CLA 2011-09-01 17:01:21 EDT
(In reply to comment #4)
> Any assessment, please? Thank you.

Sorry, not sure we can change it.
It is Windows that changed the native behaviour of the control to draw the table cell this way.

If you need to overwrite the way the control draws you need to use custom draw, see http://www.eclipse.org/swt/snippets/#table and check th snippets that talk have the word "custom" in the description.

Note that is a behaviour that changed in Windows not in SWT, (I don't believe that I can fight Windows Seven to render a la XP...)
Comment 6 gglaser CLA 2011-10-19 16:10:22 EDT
It sounds like the older version of SWT does not exhibit this behavior in Win7 - doesn't that imply that there should be some way to make it work?

Thanks
Comment 7 gglaser CLA 2011-10-19 16:13:51 EDT
> If you need to overwrite the way the control draws you need to use custom draw,
> see http://www.eclipse.org/swt/snippets/#table and check th snippets that talk
> have the word "custom" in the description.

Also it is worth noting, that in the past, I have tried to deal with rendering issues using custom listeners (paintItem/eraseItem/measureItem, etc), and the simple act of adding a listener (even with no code in it) introduced performance degradation - so ideally something as basic as this would be achievable without "custom" logic.
Comment 8 Lars Vogel CLA 2019-11-14 03:33:29 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.