Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » RAP field focus lost when moving window(Field focus difference between SWT and RAP)
RAP field focus lost when moving window [message #997242] Fri, 04 January 2013 15:58 Go to next message
John Gymer is currently offline John GymerFriend
Messages: 279
Registered: November 2012
Location: UK
Senior Member
Noticing a difference in behaviour between SWT and RAP relating to focus and location of cursor... if your cursor is in a field in SWT, and you decide to move the window a little, then cursor/focus remains with that field so you can carry on typing after the window move.
However, in RAP, as soon as you click on the window title bar to move it, the focus/cursor is no longer in the field, so you have to also click back into the field to carry on typing.

Is there an intentional reason for this, or should I raise as a bug?

Thanks, John


---
Just because you can doesn't mean you should
Re: RAP field focus lost when moving window [message #997622 is a reply to message #997242] Fri, 04 January 2013 18:16 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 396
Registered: July 2009
Senior Member
Hi.

I doubt it's intentional, that's just how browser focus behaves. It
could be a bug if SWT does specify this behavior somewhere, or if SWT
behaves like this on all platforms (Win/Mac/Linux).

It this a blocker for you? Perhaps you can work around the issue by
setting the focus again from a MouseUp event on the shell?

Greetings,
Tim

Am 04.01.2013 16:58, schrieb John Gymer:
> Noticing a difference in behaviour between SWT and RAP relating to focus
> and location of cursor... if your cursor is in a field in SWT, and you
> decide to move the window a little, then cursor/focus remains with that
> field so you can carry on typing after the window move.
> However, in RAP, as soon as you click on the window title bar to move
> it, the focus/cursor is no longer in the field, so you have to also
> click back into the field to carry on typing.
>
> Is there an intentional reason for this, or should I raise as a bug?
>
> Thanks, John
>

--
Tim Buschtöns

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: RAP field focus lost when moving window [message #1001773 is a reply to message #997622] Thu, 17 January 2013 10:55 Go to previous messageGo to next message
John Gymer is currently offline John GymerFriend
Messages: 279
Registered: November 2012
Location: UK
Senior Member
Thanks Tim.

SWT certainly behaves differently from RAP, and more intuitively too, as well as being consistent with other windowing systems.

Personally I would regard this as a bug in RAP - I'm sure it will annoy many users if they have to click focus back to a field if all they've done is to move a window by dragging its title bar. It is unintuitive.

It also seems a little strange that the window itself should even be able to get 'keyboard' focus, although perhaps I'm missing some hidden functionality that this enables that I'm not aware of?

It doesn't need any special example to show the behaviour, just a simple shell with a simple Text field like below:

package bug.snippet;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormAttachment;
import org.eclipse.swt.layout.FormData;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class Bugsy {
	private static Display display;
	private static Shell shell;
	private static Text txt;
	
	public static void main(String args[]) {
		System.out.println("BugSnippy Starting...");
		
		// create Shell
		display = new Display();
		shell = new Shell(display, SWT.TITLE|SWT.MAX|SWT.MIN|SWT.RESIZE|SWT.CLOSE);
		shell.setText("Bugsy");
		shell.setSize(300, 150);
		shell.setLocation(20, 20);
		FormLayout layout = new FormLayout();
		shell.setLayout(layout);

		// add Text entry field onto Shell
		txt = new Text(shell, SWT.SINGLE|SWT.BORDER);
		FormData fd = new FormData();
		fd.left = new FormAttachment(0, 5);
		fd.top = new FormAttachment(0, 5);
		fd.width = 100;
		fd.height = 24;
		txt.setLayoutData(fd);
		
		shell.open();

		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
		
		System.out.println("BugSnippy Done!");
	}

}


Run as SWT, you can move the window around as much as you like and the keyboard focus/caret stays in the field, as expected, but with RAP, move the window and the keyboard focus appears to transfer to the window itself, hence having to click back into the field to give it focus again (or using the tab key to sequence to it).

RAP entry point something like this (trivial example):

package bug.snippet;

import org.eclipse.rap.rwt.application.EntryPoint;

public class RAPEntryPoint_BugSnip implements EntryPoint {
	@Override
	public int createUI() {
		System.out.println("Starting RAP");
		Bugsy.main(null);
		System.out.println("RAP Done");

		return(0);
	}
}


Thanks, John


---
Just because you can doesn't mean you should
Re: RAP field focus lost when moving window [message #1001889 is a reply to message #1001773] Thu, 17 January 2013 14:12 Go to previous messageGo to next message
John Gymer is currently offline John GymerFriend
Messages: 279
Registered: November 2012
Location: UK
Senior Member
Just to clarify... it isn't the Browser window that is being moved, but the Shells within RAP that contains the Text entry field... hope that's clear!


---
Just because you can doesn't mean you should
Re: RAP field focus lost when moving window [message #1002294 is a reply to message #1001773] Fri, 18 January 2013 10:37 Go to previous messageGo to next message
Tim Buschtoens is currently offline Tim BuschtoensFriend
Messages: 396
Registered: July 2009
Senior Member
Hi.

> It also seems a little strange that the window itself should even be
> able to get 'keyboard' focus, although perhaps I'm missing some hidden
> functionality that this enables that I'm not aware of?

I had a quick look at the code, and it looks like the client will focus
the focus root (the shell) only as a last resort if there is no other
focusable widget found on any of the elements the user clicked on to.

We can examine this further if you open a bugzilla entry for this issue.
However, since this touches on some sensitive code, a fix will be
available in 2.1 (Kepler) at the earliest.

Greetings,
Tim

>
> It doesn't need any special example to show the behaviour, just a simple
> shell with a simple Text field like below:
>
>
> package bug.snippet;
>
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.layout.FormAttachment;
> import org.eclipse.swt.layout.FormData;
> import org.eclipse.swt.layout.FormLayout;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Shell;
> import org.eclipse.swt.widgets.Text;
>
> public class Bugsy {
> private static Display display;
> private static Shell shell;
> private static Text txt;
>
> public static void main(String args[]) {
> System.out.println("BugSnippy Starting...");
>
> // create Shell
> display = new Display();
> shell = new Shell(display,
> SWT.TITLE|SWT.MAX|SWT.MIN|SWT.RESIZE|SWT.CLOSE);
> shell.setText("Bugsy");
> shell.setSize(300, 150);
> shell.setLocation(20, 20);
> FormLayout layout = new FormLayout();
> shell.setLayout(layout);
>
> // add Text entry field onto Shell
> txt = new Text(shell, SWT.SINGLE|SWT.BORDER);
> FormData fd = new FormData();
> fd.left = new FormAttachment(0, 5);
> fd.top = new FormAttachment(0, 5);
> fd.width = 100;
> fd.height = 24;
> txt.setLayoutData(fd);
>
> shell.open();
>
> while (!shell.isDisposed()) {
> if (!display.readAndDispatch())
> display.sleep();
> }
> display.dispose();
>
> System.out.println("BugSnippy Done!");
> }
>
> }
>
>
> Run as SWT, you can move the window around as much as you like and the
> keyboard focus/caret stays in the field, as expected, but with RAP, move
> the window and the keyboard focus appears to transfer to the window
> itself, hence having to click back into the field to give it focus again
> (or using the tab key to sequence to it).
>
> RAP entry point something like this (trivial example):
>
>
> package bug.snippet;
>
> import org.eclipse.rap.rwt.application.EntryPoint;
>
> public class RAPEntryPoint_BugSnip implements EntryPoint {
> @Override
> public int createUI() {
> System.out.println("Starting RAP");
> Bugsy.main(null);
> System.out.println("RAP Done");
>
> return(0);
> }
> }
>
>
> Thanks, John
>

--
Tim Buschtöns

Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/

Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
Re: RAP field focus lost when moving window [message #1002296 is a reply to message #1002294] Fri, 18 January 2013 10:47 Go to previous message
John Gymer is currently offline John GymerFriend
Messages: 279
Registered: November 2012
Location: UK
Senior Member
Thanks Tim, have raised in BugZilla
Link: https://bugs.eclipse.org/bugs/show_bug.cgi?id=398478


---
Just because you can doesn't mean you should

[Updated on: Thu, 24 January 2013 11:08]

Report message to a moderator

Previous Topic:Rap exaple does not work
Next Topic:RAP focus after shell setVisible
Goto Forum:
  


Current Time: Wed Apr 24 22:21:49 GMT 2024

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

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

Back to the top