Bug 202982 - Possibility to add a VerifyListener to DateTime widget.
Summary: Possibility to add a VerifyListener to DateTime widget.
Status: NEW
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 enhancement with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-11 14:54 EDT by Pieter Agten CLA
Modified: 2021-11-12 11:42 EST (History)
6 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pieter Agten CLA 2007-09-11 14:54:05 EDT
I would be nice if it would be possible to add a VerifyListener to the DateTime control in SWT.

I tried to invalidate the user's selection of a date when it was after the date of another DateTime widget and then leave the widget back with the date it originally had.

I tried to do this using a SelectionListener and the 'e.doit' property, but that doesn't seem to work.

This code illustrates what I was trying to do:

dateTimeStart.addSelectionListener(new SelectionListener() {

  @Override
  public void widgetDefaultSelected(SelectionEvent e) {
  }

  @Override
  public void widgetSelected(SelectionEvent e) {
    if (dateIsBeforeOtherDate())
       //The date is NOT valid. The user's input should be invalidated.
       e.doit = false;
    else
       /The date is valid. The user's input should be copied to the corresponding property in the data model.
       setNewDateInModel();
    }
 });

This code doesn't work. Eventhough e.doit is set to false, the input of the DateTime widget still changes.

The solution would be to add a VerifyListener to the DateTime control, but this is currently not possible.
Comment 1 Alexander Ilyin CLA 2008-02-23 08:27:22 EST
Also please add SWT.Modify event (to have a chance share common listeners with Text controls). 
And requested SWT.Verify event is absolutely needed to make things like setting the min/max limits for date/time. 
Comment 2 Lars Vogel CLA 2019-09-24 13:58:09 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.