Bug 248984 - removing SWT.BACKGROUND from EraseItem does not veto item background
Summary: removing SWT.BACKGROUND from EraseItem does not veto item background
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-29 12:41 EDT by Grant Gayed CLA
Modified: 2019-09-06 16:04 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.