Community
Participate
Working Groups
M4 test pass (I20041214-2000-gtk) see attached screenshot - the light bulb shows on two lines.
Created attachment 16633 [details] cms.png
Markus, please investigate and coordinate with Andre.
Looks like the table widget has problems calculating the relative coordinates on GTK.
Moving to Platform/SWT. I debugged this, and the coordinate transformations look fine. The snippet below shows that the bug is in the GTK table drawing code. With table.setHeaderVisible (true), the oval is not drawn around the item. With table.setHeaderVisible (false), the oval is more or less correctly drawn. I went back to 3.0.0, and found that this bug is already present in that build. package p; import org.eclipse.swt.SWT; import org.eclipse.swt.events.PaintEvent; import org.eclipse.swt.events.PaintListener; import org.eclipse.swt.graphics.Rectangle; 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 SnippetBug81102 { public static void main (String [] args) { Display display = new Display (); Shell shell = new Shell (display); Table table = new Table (shell, SWT.MULTI | SWT.BORDER | SWT.FULL_SELECTION); table.setLinesVisible (true); table.setHeaderVisible (true); // swap this String[] titles = {"Column 1", "Column 1"}; for (int i=0; i<titles.length; i++) { TableColumn column = new TableColumn (table, SWT.NULL); column.setText (titles [i]); } int count = 5; for (int i=0; i<count; i++) { TableItem item = new TableItem (table, SWT.NULL); item.setText (0, "line " + i); } for (int i=0; i<titles.length; i++) { table.getColumn (i).pack (); } final TableItem item0 = table.getItem(0); item0.setText(1, "item0"); table.addPaintListener(new PaintListener() { public void paintControl(PaintEvent e) { Rectangle b = item0.getBounds(1); e.gc.drawOval(b.x, b.y, b.width, b.height); } }); table.setSize (table.computeSize (SWT.DEFAULT, 200)); shell.pack (); shell.open (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } }
Marking as a duplicate of bug 42416. Please note that drawing in the paint event of a widget is not a reliable thing to do. It assumes that native widgets only draw in their paint events and this is not guaranteed. The paint event is really for drawing your own custom widget on a Composite or Canvas. Drawing on other widgets can result in random cheese. *** This bug has been marked as a duplicate of 42416 ***