SWT Browser Control loosing focus on Enter key press [message #506946] |
Mon, 11 January 2010 08:27 |
Nitesh Agrawal Messages: 4 Registered: January 2010 |
Junior Member |
|
|
Hello Experts,
I have created a Rich text editor using a SWT browser control.
The Editor is woring perfectly fine when run as an independent
application.
Now, I have a RCP application, in which I have a mulipage editor,
this multipage editor has a SWT Section control.
I am placing my Rich Text editor inside this Section.
Now, when I write some thing on the first line and press 'Enter'
the focus is getting lost from the Rich text editor. I have observer that on pressing enter, the focus is getting lost from multipage editor itself.
I have tried a couple of this till now to handle this situation, like handling the Enter press key explicitly, but with no success.
any suggestions on why it works in a stand alone mode but loses focus when embedding inside a section.
Thanks and regards,
Nitesh
|
|
|
Re: SWT Browser Control loosing focus on Enter key press [message #507473 is a reply to message #506946] |
Wed, 13 January 2010 15:33 |
Grant Gayed Messages: 2150 Registered: July 2009 |
Senior Member |
|
|
Hi Nitesh,
I would guess that one of the following has changed when you run in the
context of an RCP app:
- a default button is now present in the parent Shell, which takes focus
when Enter is pressed
- an accelerator is defined that is being triggered (an accelerator of
'Enter' does not seem too likely)
I tried to make a case of a default button stealing focus when pressing
Enter in a Browser but could not. I tried a page with a <textarea>, and I
tried google, and in both cases pressing Enter did not send focus to my
default button (perhaps it should have). Anyways, you can prove/disprove
the default button theory by adding a display filter like:
display.addFilter(SWT.FocusIn, new Listener() {
public void handleEvent(Event event) {
Control focusControl = display.getFocusControl();
boolean isDefaultButton = shell.getDefaultButton() == focusControl;
System.out.println("new focus control: " + focusControl + " is
default button: " + isDefaultButton);
}
});
Also, which platform and swt version are you using?
Grant
"Nitesh" <niteshsince1982@gmail.com> wrote in message
news:hif90e$no7$1@build.eclipse.org...
> Hello Experts,
>
> I have created a Rich text editor using a SWT browser control.
> The Editor is woring perfectly fine when run as an independent
> application.
> Now, I have a RCP application, in which I have a mulipage editor,
> this multipage editor has a SWT Section control.
> I am placing my Rich Text editor inside this Section.
> Now, when I write some thing on the first line and press 'Enter'
> the focus is getting lost from the Rich text editor. I have observer that
on pressing enter, the focus is getting lost from multipage editor itself.
> I have tried a couple of this till now to handle this situation, like
handling the Enter press key explicitly, but with no success.
>
> any suggestions on why it works in a stand alone mode but loses focus when
embedding inside a section.
>
> Thanks and regards,
> Nitesh
|
|
|
|
Powered by
FUDForum. Page generated in 0.02557 seconds