[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Text Widget: How to check (verify) user input?

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