Community
Participate
Working Groups
I have a StyledText control (created with the flags SWT.READ_ONLY | SWT.SINGLE) in our application with a FocusIn-Listener that has a couple of parents, one is set to invisible. However, when showing this shell, SWT wants to make this control focusable. I have added following code to the FocusIn-Listener: for (Control control = label; control != null; control = control.getParent()) { System.out.println(control.getClass() + " " + control.getVisible()); } new Throwable().printStackTrace(); and I'm getting following output: class org.eclipse.swt.custom.StyledText true class org.eclipse.swt.widgets.Composite true class org.eclipse.swt.widgets.Composite true class org.eclipse.swt.widgets.Composite true class org.eclipse.swt.widgets.Composite true class org.eclipse.swt.widgets.Composite false class com.syntevo.q.gui.QSashForm true class org.eclipse.swt.widgets.Composite true class org.eclipse.swt.widgets.Shell true java.lang.Throwable at com.syntevo.q.gui.QBannerPanel$Banner.lambda$createLabel$0(QBannerPanel.java:202) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89) at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4441) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1512) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1535) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1516) at org.eclipse.swt.widgets.Control.sendFocusEvent(Control.java:3439) at org.eclipse.swt.widgets.Canvas.sendFocusEvent(Canvas.java:80) at org.eclipse.swt.widgets.Display.checkFocus(Display.java:684) at org.eclipse.swt.widgets.Shell.makeFirstResponder(Shell.java:1319) at org.eclipse.swt.widgets.Display.windowProc(Display.java:6281) at org.eclipse.swt.internal.cocoa.OS.objc_msgSend(Native Method) at org.eclipse.swt.internal.cocoa.NSWindow.makeKeyAndOrderFront(NSWindow.java:201) at org.eclipse.swt.widgets.Shell.makeKeyAndOrderFront(Shell.java:1337) at org.eclipse.swt.widgets.Shell.setWindowVisible(Shell.java:2104) at org.eclipse.swt.widgets.Shell.open(Shell.java:1397) ... Unfortunately, I was not able to extract a test snippet where this behavior is reproducible. I suggest to add either an assertion or check to Display.checkFocus that the newControl.isVisible returns true.