|
Re: How to catch ENTER on a button [message #89531 is a reply to message #89516] |
Fri, 23 May 2008 10:12 |
Eclipse User |
|
|
|
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
|
|
|
|
Powered by
FUDForum. Page generated in 0.03824 seconds