Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Text Widget: How to check (verify) user input?
Text Widget: How to check (verify) user input? [message #462477] Wed, 12 October 2005 20:16 Go to next message
Andreas is currently offline AndreasFriend
Messages: 29
Registered: July 2009
Junior Member
Hi,

i know this is kinda of a basic question. But i wonder how i can best
verify the user input of a text widget, where the user can type in free
text.

In my specific case i only want to allow Integer from 0 on....


How can i do this best?

thanks for any help
Andreas
Re: Text Widget: How to check (verify) user input? [message #462481 is a reply to message #462477] Wed, 12 October 2005 21:03 Go to previous messageGo to next message
Jeff Myers is currently offline Jeff MyersFriend
Messages: 489
Registered: July 2009
Senior Member
Andreas,

You can use a VerifyListener to listen to changes on the text widget.
From the VerifyEvent you can get the new text that's being entered so
you can figure out if it'd result in an invalid value. If you have an
invalid state, you set the doit field on the VerifyEvent to false, and
the new text won't show up in the text field.

See the SWT Snippets related to the Text widget for examples:
http://www.eclipse.org/swt/snippets/

Hope this helps,
- Jeff

Andreas wrote:
> Hi,
>
> i know this is kinda of a basic question. But i wonder how i can best
> verify the user input of a text widget, where the user can type in free
> text.
>
> In my specific case i only want to allow Integer from 0 on....
>
>
> How can i do this best?
>
> thanks for any help
> Andreas
>
Re: Text Widget: How to check (verify) user input? [message #462507 is a reply to message #462481] Thu, 13 October 2005 09:18 Go to previous message
Andreas is currently offline AndreasFriend
Messages: 29
Registered: July 2009
Junior Member
Jeff,

thanks a lot for your answer and pointing me towards the snippets.

I used code provided there and it works like a champ now.

Have a nice day
Andreas
Previous Topic:support multiple transfer in DND
Next Topic:open a SWT form from another SWT form
Goto Forum:
  


Current Time: Fri Mar 29 05:25:06 GMT 2024

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

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

Back to the top