| Summary: | Tree with background image draws incorrectly on new TreeItem | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | ArronM <arronm> | ||||
| Component: | SWT | Assignee: | Platform-SWT-Inbox <platform-swt-inbox> | ||||
| Status: | CLOSED WONTFIX | QA Contact: | |||||
| Severity: | normal | ||||||
| Priority: | P3 | ||||||
| Version: | 3.6 | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows 7 | ||||||
| Whiteboard: | stalebug | ||||||
| Attachments: |
|
||||||
Created attachment 173040 [details]
What happens after clicking "Add Row" once
Wish I could edit comments and remove the double negative of "isn't not". Just mentally ignore the "not" please :) 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. 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. |
Build Identifier: SWT3650 Given a tree with setBackgroundImage set, the whole table isn't not repainted on a "new TreeItem(..)". Only the area with the rows plus one row height is invalidated. See snippet below. Click the Add Row button and the circle will shift down (must be a Windows optimization thing). Workaround is to call redraw() on adding a row ("Add Row With Redraw" button), but it has an ugly flicker to it. Reproducible: Always Steps to Reproduce: import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.GC; import org.eclipse.swt.graphics.Image; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.*; public class testTableBackground { public static void main(String[] args) { Display display = new Display(); Shell shellMain = new Shell(display, SWT.SHELL_TRIM); GridLayout l = new GridLayout(); l.marginHeight = l.marginWidth = 10; shellMain.setLayout(l); final Tree tree = new Tree(shellMain, SWT.BORDER | SWT.VIRTUAL | SWT.FULL_SELECTION); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); tree.setLayoutData(gridData); new TreeColumn(tree, SWT.RIGHT); tree.setHeaderVisible(true); tree.getColumn(0).setWidth(300); int size = 200; Image image = new Image(display, size, size); GC gc = new GC(image); gc.setForeground(display.getSystemColor(SWT.COLOR_GRAY)); gc.drawOval(0, 0, size, size); gc.dispose(); tree.setBackgroundImage(image); Button button = new Button(shellMain, SWT.PUSH); button.setText("Add Row"); button.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { new TreeItem(tree, SWT.NONE).setText("row"); } }); Button button2 = new Button(shellMain, SWT.PUSH); button2.setText("Add Row And Redraw"); button2.addListener(SWT.Selection, new Listener() { public void handleEvent(Event event) { new TreeItem(tree, SWT.NONE).setText("row"); tree.redraw(); } }); //////////////// shellMain.setSize(400, 600); shellMain.open(); while (!shellMain.isDisposed()) { try { if (!display.readAndDispatch()) display.sleep(); } catch (Throwable t) { t.printStackTrace(); } } display.dispose(); }