Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » How to catch ENTER on a button
How to catch ENTER on a button [message #89516] Fri, 23 May 2008 09:42 Go to next message
Torge Kummerow is currently offline Torge KummerowFriend
Messages: 26
Registered: July 2009
Junior Member
Hi,

I have a textfield and a button. I want the user to automatically enter text
to the textfield when joining the page and if he presses ENTER the button
should be triggerd.

How do I do that?

Thanks in advance,
Torge.
Re: How to catch ENTER on a button [message #89531 is a reply to message #89516] Fri, 23 May 2008 10:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: rsternberg.innoopract.com

Hi Torge,

Torge Kummerow wrote:
> I have a textfield and a button. I want the user to automatically enter
> text to the textfield when joining the page and if he presses ENTER the
> button should be triggerd.
>
> How do I do that?

For SINGLE Texts, a SWT.DefaultSelection event is fired on Enter key
press. Thus, if your text field is a SINGLE Text, you can simply add a
SelectionListener on it and trigger the button on widgetDefaultSelected.

You can also make your Button the default button on the containing Shell
(Shell#setDefaultButton). In this case, the button is triggered whenever
Enter is pressed somewhere inside the shell.

Best regards,
Ralf
Re: How to catch ENTER on a button [message #89546 is a reply to message #89531] Fri, 23 May 2008 10:21 Go to previous message
Torge Kummerow is currently offline Torge KummerowFriend
Messages: 26
Registered: July 2009
Junior Member
Thank you for the fast reply. Will try that.

"Ralf Sternberg" <rsternberg@innoopract.com> schrieb im Newsbeitrag
news:g1659o$639$1@build.eclipse.org...
> Hi Torge,
>
> Torge Kummerow wrote:
>> I have a textfield and a button. I want the user to automatically enter
>> text to the textfield when joining the page and if he presses ENTER the
>> button should be triggerd.
>>
>> How do I do that?
>
> For SINGLE Texts, a SWT.DefaultSelection event is fired on Enter key
> press. Thus, if your text field is a SINGLE Text, you can simply add a
> SelectionListener on it and trigger the button on widgetDefaultSelected.
>
> You can also make your Button the default button on the containing Shell
> (Shell#setDefaultButton). In this case, the button is triggered whenever
> Enter is pressed somewhere inside the shell.
>
> Best regards,
> Ralf
Previous Topic:Truncated table header texts
Next Topic:Minimize editor area
Goto Forum:
  


Current Time: Sat Apr 20 01:57:42 GMT 2024

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

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

Back to the top