Bug 265470 - SWT.Deactivate sent twice when hiding the deactivating shell
Summary: SWT.Deactivate sent twice when hiding the deactivating shell
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.4   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-19 10:29 EST by Randy Hudson CLA
Modified: 2019-09-06 16:08 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Randy Hudson CLA 2009-02-19 10:29:41 EST
1) Press the giant button to open a popup shell.
2) Click back on the titlebar of the first shell.

bug: Deactivate event is received twice.

When I found this, my deactivate listener was eventually disposing the shell, which caused problems when I tried to do it twice.

public class ShellSnippet {
	
static final Display display = new Display();
static Shell shell;

public static void main(String[] args) {
	shell = new Shell(display);
	shell.setLayout(new FillLayout());
	shell.setSize(400, 300);
	
	new Button(shell, SWT.PUSH).addListener(SWT.Selection, new Listener() {
		public void handleEvent(Event event) {
			popup();
		}
	});
	
	shell.open();
	while (!shell.isDisposed())
		while (!display.readAndDispatch())
			display.sleep();
}

static void popup() {
	final Shell popup = new Shell();
	popup.pack();
	popup.addListener(SWT.Deactivate, new Listener() {
		public void handleEvent(Event event) {
			System.out.println("Deactivate");
			popup.setVisible(false);
		}
	});
	
	popup.addListener(SWT.Activate, new Listener() {
		public void handleEvent(Event event) {
			System.out.println("Activate");
		}
	});
	
	popup.open();
}

}
Comment 1 Eclipse Webmaster CLA 2019-09-06 16:08:32 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.