Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 429249

Summary: FocusListener on labels are not notified
Product: [RT] RAP Reporter: Michael Klein <michael.klein>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED INVALID QA Contact:
Severity: normal    
Priority: P3 CC: ivan, michael.klein
Version: 2.2   
Target Milestone: ---   
Hardware: All   
OS: Windows 7   
Whiteboard:

Description Michael Klein CLA 2014-02-27 10:33:19 EST
Environment: Firefox 27.0.1 / IE 11.0.9600.16518 / Chrome 33.0.1750.117 on Win7

The bug occurs with rap-2.2.0-R-20131204-0942 and rap-2.3.0-N-20140226-1607.
Works with rap-2.1.0-R-20130611-2139.


Steps to reproduce:
* create a composite
* create a label behind the composite
* add FocusListener to the composite
* add FocusListener to the label
* click on composite and click on label
-> Only the FocusListener of the composite is notified

Expected:
The FocusListener of the label should also be notified on focus events.


Here is a snippet to reproduce:

public class BasicEntryPoint extends AbstractEntryPoint {

    protected void createContents(Composite parent) {
        parent.setLayout(new GridLayout(2, false));
        Composite composite = new Composite(parent, SWT.NONE);
		composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
		composite.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_RED));
		composite.addFocusListener(new FocusListener() {
			
			@Override
			public void focusLost(FocusEvent event) {
				System.out.println("RED focusLost()");
			}
			
			@Override
			public void focusGained(FocusEvent event) {
				System.out.println("RED focusGained()");
			}
		});
		
		Label label = new Label(parent, SWT.NONE);
		label.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
		label.setText("Label");
		label.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_GREEN));
		label.addFocusListener(new FocusListener() {
			
			@Override
			public void focusLost(FocusEvent event) {
				System.out.println("GREEN focusLost()");
			}
			
			@Override
			public void focusGained(FocusEvent event) {
				System.out.println("GREEN focusGained()");
			}
		});
    }

}
Comment 1 Ivan Furnadjiev CLA 2014-02-27 10:42:24 EST
Labels are not focusable controls both in SWT and RWT.