Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Focus, Composite and Popup Menu(Input field (e.g. Text) looses Focus when PopupMenu is shown for the owning Composite)
Focus, Composite and Popup Menu [message #1744485] Tue, 27 September 2016 12:02 Go to next message
Gunnar Adams is currently offline Gunnar AdamsFriend
Messages: 49
Registered: May 2016
Member
Hi,

My application is made up of a Shell containing a Composite on which a number of input fields are located. Focus traversal between those input fields works fine (both using keyboard traversal and mouse clicks).

Within the application it is possible to show (different) context menus on both the containing Composite and each individual input field.
Problem:
The keyboard focus is in a input field. When I show the context menu for the Composite (by pressing the right mouse button while over the Composite), the focus is removed from the current focus field.

Display.getFocusControl() returns the Composite.

Because a Composite by itself should not be able to get the keyboard focus, I find this irritating and suspect an error. I expect the keyboard focus to remain in the input field instead.

Questions:
1. can you confirm that this is the intended behavior?
2. can this behavior be prevented or worked around (preferrably on the server side)?

Kind regards,
Gunnar





Re: Focus, Composite and Popup Menu [message #1744619 is a reply to message #1744485] Thu, 29 September 2016 02:38 Go to previous messageGo to next message
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 221
Registered: February 2011
Senior Member
Have you tried passing SWT.NO_FOCUS as a style bit to the Composite?
The keyboard and mouse focus are the same thing, Clicking anything that can accept mouse focus will also take keyboard focus.
Re: Focus, Composite and Popup Menu [message #1744631 is a reply to message #1744619] Thu, 29 September 2016 07:00 Go to previous messageGo to next message
Gunnar Adams is currently offline Gunnar AdamsFriend
Messages: 49
Registered: May 2016
Member
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):

Shell
Composite 1 (with style SWT.NO_FOCUS)
Composite 2 (with style SWT.NO_FOCUS)
Composite 3 (with style SWT.NO_FOCUS)
Text

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.

Is there some kind of "display filter" on the client-side where the offending focus activation could be prevented? My knowledge about Javascript is limited and I did not yet reverse engineer and analyze the inner workings of the RAP client code.

Best regards,
Gunnar
Re: Focus, Composite and Popup Menu [message #1744754 is a reply to message #1744631] Fri, 30 September 2016 01:33 Go to previous message
Chris Fairhall is currently offline Chris FairhallFriend
Messages: 221
Registered: February 2011
Senior Member
I guess you'll need to wait for bug 398478 to be fixed.

Display filters in RAP aren't as powerful as they are in SWT, due to the issues resulting from network latency
Previous Topic:How to Set WebClient.PAGE_OVERFLOW Property in RAP with Workbench Setup?
Next Topic:Building Maven artifacts
Goto Forum:
  


Current Time: Tue Mar 19 06:32:45 GMT 2024

Powered by FUDForum. Page generated in 0.02322 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top