Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 295869

Summary: [Win32] Background color of one table cell does not fill the whole cell if TableEditor is used
Product: [Eclipse Project] Platform Reporter: Bernhard Gruber <gruberb>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: cocoakevin, eclipse.felipe, niraj.modi, psuzzi
Version: 3.5.1Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Windows All   
See Also: https://bugs.eclipse.org/bugs/show_bug.cgi?id=224954
Whiteboard: stalebug
Attachments:
Description Flags
screenshot of the modifed snippet
none
full source code of modified snippet none

Description Bernhard Gruber CLA 2009-11-23 09:33:21 EST
Created attachment 152857 [details]
screenshot of the modifed snippet

I have the requirement to implement an editable table using the SWT Table.
There exist good example, how to do this using TableCursor and TableEditor. An
additional requirement is to be able to color the table cells individually.
Here a nasty problem shows up. The background color of one cell of the first
column is not filling the whole cell. Only the text of the cell is drawn with
the correct background color. The rest of the cell is white.

The same phenomenon shows up in the example snipped provided at
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets/Snippet124.java

I just changed the code to use a background color for each TableItem.
changed from:
    for (int i=0; i<3; i++) {
        TableItem item = new TableItem (table, SWT.NONE);
        item.setText(new String [] {"" + i, "" + i , "" + i});
    }
changed to:
    Color color = display.getSystemColor(SWT.COLOR_RED);
    for (int i=0; i<3; i++) {
        TableItem item = new TableItem (table, SWT.NONE);
        item.setText(new String [] {"" + i, "" + i , "" + i});
        item.setBackground(color);
    }
Comment 1 Bernhard Gruber CLA 2009-11-23 09:37:33 EST
Created attachment 152858 [details]
full source code of modified snippet
Comment 2 Felipe Heidrich CLA 2009-11-23 10:48:49 EST
This bug is very similar to Bug 295319, it manifest itself when the table is custom draw or not SWT.FULL_SELECTION.

Please try to create your table with SWT.FULL_SELECTION, can you use it has a workaround till the real problem gets fixed ?
Comment 3 Bernhard Gruber CLA 2009-11-24 08:44:17 EST
I do not think SWT.FULL_SELECTION is a good workaround for me.
But I can wait for a fix if it does not take to long time.
Comment 4 Eclipse Genie CLA 2019-11-16 10:44: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.

--
The automated Eclipse Genie.