|Re: Focus, Composite and Popup Menu [message #1744631 is a reply to message #1744619]
||Thu, 29 September 2016 07:00
| Gunnar Adams
Registered: May 2016
Thank you very much for your response.|
Yes, I had already tried setting SWT.NO_FOCUS.
The structure of the application window is something like this (from bottom to top):
Composite 1 (with style SWT.NO_FOCUS)
Composite 2 (with style SWT.NO_FOCUS)
Composite 3 (with style SWT.NO_FOCUS)
Without the NO_FOCUS style, I see that the focus control changes to Composite 3, when I click (left or right mouse button) anywhere on Composite 3 outside of Text.
I determined this by looking at event.display.getFocusControl() in a FocusOut event of the Text widget.
With the NO_FOCUS styles on composite, the Shell becomes the focus control, even when I also set SWT.NO_FOCUS on the Shell.
It was my understanding, that a composite cannot receive keyboard focus. I also did not know, that the concept of "mouse focus" even exists.
I therefore did not expect a click on the composite to interfere with the current focus control.
I think that my problem is a generalization of Bug 398478
https://bugs.eclipse.org/bugs/show_bug.cgi?id=398478, because in my opinion any mouse click in an area which is not a widget that can accept keyboard focus, should not change the focus.
I can probably implement a server-side workaround by determining the current focus control and setting the focus back to the previous one, but this will still interfere with things like the current caret position within text controls.
Powered by FUDForum
. Page generated in 0.02174 seconds