Project: SWT
Bug 84051 Table widget unexpectedly fire deactivated event while clicking scroll bar buttons.
Reported: 2005-01-31 11:08:34 | Status: resolved fixed

I have created listeners to a table widget for its activate and deactivate events. When I click on the table, the table fires an activate event. When the table becomes out of focus, it fires an deactivate event. If I have the table activated, and then keeps clicking on the scroll bar, the table will eventually fire a deactivate event. This behaviour is different from that on Windows and since the table is still in focus, it should not fire a deactivate event. Here's the testcase deomonstrating the problem: public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setBounds(10,10,400,400); final Table table = new Table(shell, SWT.NONE); table.setBounds(10,10,100,100); for (int i = 0; i < 99; i++) { new TableItem(table, SWT.NONE).setText("item " + i); } table.addListener(SWT.Activate, new Listener() { public void handleEvent(Event arg0) { System.out.println(" 1 activated"); }}); table.addListener(SWT.Deactivate, new Listener() { public void handleEvent(Event arg0) { System.out.println(" 1 deactivated"); }}); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } display.dispose(); }

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java