Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » EPF » catch the "return" key
catch the "return" key [message #52860] Fri, 22 August 2008 09:15 Go to next message
Aline is currently offline AlineFriend
Messages: 32
Registered: July 2009
Member
Hi !

I would like to catch the return key in the rich text tab of an
RichTextEditor to insert a new line. For now, it just "simulates" the
pressing of the [OK] button.
I tried to add a keylistener to the RichTextEditor object but special keys
such as return key or backspace key are not catched. I also tried to
implements my class from KeyListener with no results.

Does anyone have some ideas to fix this ?

I also noticed that some key events are not catch in the keyPressed
function but they are in the keyReleased function. Does anyone know why ?

thanks in advance,

Aline
Re: catch the "return" key [message #52941 is a reply to message #52860] Fri, 22 August 2008 13:08 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Aline wrote:
> Hi !
>
> I would like to catch the return key in the rich text tab of an
> RichTextEditor to insert a new line. For now, it just "simulates" the
> pressing of the [OK] button.
> I tried to add a keylistener to the RichTextEditor object but special
> keys such as return key or backspace key are not catched. I also tried
> to implements my class from KeyListener with no results.
>
> Does anyone have some ideas to fix this ?

If you're talking about placing a RichTextEditor in a JFace Dialog, then
the answer is to override
org.eclipse.jface.dialogs.Dialog.createButtonsForButtonBar(C omposite)
and change the way it creates the OK button (pass false as the final
argument to createButton() instead of true).

Hope this helps,
Eric
Re: catch the "return" key [message #53014 is a reply to message #52941] Sat, 23 August 2008 18:57 Go to previous message
Aline is currently offline AlineFriend
Messages: 32
Registered: July 2009
Member
Yeah !!! thx a lot !
Re: catch the "return" key [message #590213 is a reply to message #52860] Fri, 22 August 2008 13:08 Go to previous message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3070
Registered: July 2009
Senior Member
Aline wrote:
> Hi !
>
> I would like to catch the return key in the rich text tab of an
> RichTextEditor to insert a new line. For now, it just "simulates" the
> pressing of the [OK] button.
> I tried to add a keylistener to the RichTextEditor object but special
> keys such as return key or backspace key are not catched. I also tried
> to implements my class from KeyListener with no results.
>
> Does anyone have some ideas to fix this ?

If you're talking about placing a RichTextEditor in a JFace Dialog, then
the answer is to override
org.eclipse.jface.dialogs.Dialog.createButtonsForButtonBar(C omposite)
and change the way it creates the OK button (pass false as the final
argument to createButton() instead of true).

Hope this helps,
Eric
Re: catch the "return" key [message #590254 is a reply to message #52941] Sat, 23 August 2008 18:57 Go to previous message
Aline is currently offline AlineFriend
Messages: 32
Registered: July 2009
Member
Yeah !!! thx a lot !
Previous Topic:a question about epf rich edit:
Next Topic:How to provide link to a file
Goto Forum:
  


Current Time: Fri Apr 26 08:00:28 GMT 2024

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

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

Back to the top