Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Validation in SWT DateTime widget?
Validation in SWT DateTime widget? [message #653314] Wed, 09 February 2011 10:37 Go to next message
Ben Rowlands is currently offline Ben RowlandsFriend
Messages: 3
Registered: February 2011
Junior Member
How can I run some validation logic before the date in an SWT DataTime widget is set?

I'd hope to pop up an error box, add some error decoration or even just ignore these invalid dates. Note, I don't mean dates for illegal day/month combinations -- these can't be set using the widget anyway -- rather, my application only allows users to select and use dates that they've not previously selected.

I tried setting e.doIt = false in a selection listener but this is ignored (I suspect the change has already occurred at this point in time).

Thanks,

Ben
Re: Validation in SWT DateTime widget? [message #653321 is a reply to message #653314] Wed, 09 February 2011 11:16 Go to previous messageGo to next message
Thomas Schindl is currently offline Thomas SchindlFriend
Messages: 6546
Registered: July 2009
Senior Member
You need to reset the value in an Display#async() in your selection
listener.

Tom

Am 09.02.11 11:37, schrieb Ben Rowlands:
> How can I run some validation logic before the date in an SWT DataTime
> widget is set?
> I'd hope to pop up an error box, add some error decoration or even just
> ignore these invalid dates. Note, I don't mean dates for illegal
> day/month combinations -- these can't be set using the widget anyway --
> rather, my application only allows users to select and use dates that
> they've not previously selected.
>
> I tried setting e.doIt = false in a selection listener but this is
> ignored (I suspect the change has already occurred at this point in time).
>
> Thanks,
>
> Ben
Re: Validation in SWT DateTime widget? [message #653365 is a reply to message #653321] Wed, 09 February 2011 14:33 Go to previous message
Grant Gayed is currently offline Grant GayedFriend
Messages: 2150
Registered: July 2009
Senior Member
Also, you may wish to CC yourself to the existing request for this:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=202982 .

Grant


"Tom Schindl" <tom.schindl@bestsolution.at> wrote in message
news:iitsn5$btk$1@news.eclipse.org...
> You need to reset the value in an Display#async() in your selection
> listener.
>
> Tom
>
> Am 09.02.11 11:37, schrieb Ben Rowlands:
>> How can I run some validation logic before the date in an SWT DataTime
>> widget is set?
>> I'd hope to pop up an error box, add some error decoration or even just
>> ignore these invalid dates. Note, I don't mean dates for illegal
>> day/month combinations -- these can't be set using the widget anyway --
>> rather, my application only allows users to select and use dates that
>> they've not previously selected.
>>
>> I tried setting e.doIt = false in a selection listener but this is
>> ignored (I suspect the change has already occurred at this point in
>> time).
>>
>> Thanks,
>>
>> Ben
>
Previous Topic:XULRunner and file handling / mimetypes
Next Topic:How ro set Dataformat for DateTime widget
Goto Forum:
  


Current Time: Mon Apr 06 19:00:11 GMT 2020

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

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

Back to the top