Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317800 - [DateTime] Sometimes an opened DropDown-Calendar from a Drop-Down DateTime-Widget within a resizable dialog is unclosable
Summary: [DateTime] Sometimes an opened DropDown-Calendar from a Drop-Down DateTime-Wi...
Status: RESOLVED FIXED
Alias: None
Product: RAP
Classification: RT
Component: RWT (show other bugs)
Version: 1.3   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 1.4 M1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-24 06:37 EDT by Bassspieler CLA
Modified: 2010-06-30 03:42 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Bassspieler CLA 2010-06-24 06:37:26 EDT
Build Identifier: RAP 1.3 Final

Conditions:
DateTime(SWT.DATE | SWT.DROP_DOWN | SWT.BORDER)-Widget in a resizable dialog. Try to select a date in the future (>2 months) via the drop-down-calendar.

Effect:
Sometimes (1of10) the opened calendar is unclosable. Usually it closes automatically, when you click a specific date.
It occurs more often, if you put two DateTime-widgets inside the dialog.

SNIPPET:
import org.eclipse.jface.dialogs.TrayDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.Shell;

public class DateTimeDialog extends TrayDialog {

	public DateTimeDialog(Shell shell) {
		super(shell);
	}

	@Override
	protected Control createDialogArea(Composite parent) {

		DateTime dtDate = new DateTime(parent, SWT.DATE | SWT.DROP_DOWN | SWT.BORDER);
		dtDate.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
		dtDate.setDate(2010, 1, 2);

		DateTime dtDate1 = new DateTime(parent, SWT.DATE | SWT.DROP_DOWN | SWT.BORDER);
		dtDate1.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
		dtDate1.setDate(2010, 1, 3);

		return parent;
	}

	@Override
	protected boolean isResizable() {
		return true;
	}

}

http://www.eclipse.org/forums/index.php?t=msg&th=170511

Reproducible: Sometimes

Steps to Reproduce:
1. Open dialog from snippet
2. Open drop-down calendar
3. Select a date that is min. 2 months in the future
-> calendar does not close sometimes
Comment 1 Ivan Furnadjiev CLA 2010-06-30 03:42:26 EDT
This happens when the dropped calendar overlaps the resizeable dialog borders or start dialog resizing with dropped calendar. Click on the date, which is on the top of the dialog border trigger dialog resize on mousedown. Thus, the setCapture is reset on mouse down and click (mouseup) event is never reached the DateTime widget. The fix is to listen for mousedown event instead of click in DateTimeDate.