Bug 248984

Summary: removing SWT.BACKGROUND from EraseItem does not veto item background
Product: [Eclipse Project] Platform Reporter: Grant Gayed <grant_gayed>
Component: SWTAssignee: Steve Northover <steve_northover>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3    
Version: 3.4   
Target Milestone: ---   
Hardware: PC   
OS: Windows 2000   
Whiteboard:

Description Grant Gayed CLA 2008-09-29 12:41:53 EDT
- run the snippet below
- the second item should have a green background, because the SWT.BACKGROUND bit is cleared from the EraseItem event's detail field for it, but it is red

static void tableEraseItemListener() {
	final Display display = new Display();
	Shell shell = new Shell(display);
	shell.setBounds(10,10,200,200);
	shell.setLayout(new FillLayout());
	final Table table = new Table(shell, SWT.CHECK);
	for (int i = 0; i < 2; i++) {
		new TableColumn(table, SWT.NONE).setWidth(80);
	}
	for (int i = 0; i < 2; i++) {
		TableItem item = new TableItem(table, SWT.NONE);
		item.setText(new String[] {"one","two"});
		item.setBackground(display.getSystemColor(SWT.COLOR_RED));
	}
	table.addListener(SWT.EraseItem, new Listener() {
		public void handleEvent(Event event) {
			if (table.indexOf((TableItem)event.item) == 1) {
				event.detail &= ~SWT.BACKGROUND;
				event.gc.setBackground(display.getSystemColor(SWT.COLOR_GREEN));
				event.gc.fillRectangle(event.gc.getClipping());
			}
		}
	});
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) display.sleep();
	}
	display.dispose();
}
Comment 1 Eclipse Webmaster CLA 2019-09-06 16:04:03 EDT
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.