Skip to main content



      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 16:16 Go to next message
Eclipse UserFriend
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 17:03 Go to previous messageGo to next message
Eclipse UserFriend
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 05:18 Go to previous message
Eclipse UserFriend
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: Sun Jul 20 14:12:19 EDT 2025

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

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

Back to the top