Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 185739 - [CDateTime] Cannot close dropdown in a JFace dialog
Summary: [CDateTime] Cannot close dropdown in a JFace dialog
Status: CLOSED WONTFIX
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Nebula (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal with 2 votes (vote)
Target Milestone: ---   Edit
Assignee: Jeremy Dowdall CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-07 07:14 EDT by Nicolas Richeton CLA
Modified: 2021-07-05 11:41 EDT (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 Nicolas Richeton CLA 2007-05-07 07:14:02 EDT
When using a CDateTime widget with CDT.DROP_DOWN in a JFace dialog, the drop down cannot be closed by clicking outside of the calendar/clock.

The calendar can be closed by choosing a date or pressing "ESC", but the analog clock can only be closed by pressing "ESC", which cancels the selection (it is impossible to change the time using the dropdown)

This problem occurs at least on win32 and OS X

When using the widget in a RCP view, it behaves as expected.

If the standard behavior is not possible to implement in a dialog, there should be at least "close" and "ok" buttons to help the user.
Comment 1 Martin Sooriam CLA 2007-06-18 08:56:15 EDT
There is no way to get out of the CDateTime editor, except by pressing Cancel or by clciking on "Today is ..." button or by clicking on a date on the calendar.  Is there anyway to close the CDateTime editor if the user click anywhere outside the window that CDateTime is displayed in.  This would be the behavior analogous to a combobox.
Comment 2 Peter Centgraf CLA 2007-07-12 16:19:20 EDT
The culprit appears to be AbstractCombo.createContentShell().  If the shell that contains the CDateTime is modal, this method creates a modal popup for the pickers.  Since the pickers are in a modal Shell, events on the background Shell (including events on the CDateTime) are ignored.
Comment 3 Peter Centgraf CLA 2007-07-12 16:48:07 EDT
Jeremy, I just commented out the whole case check on the parent shell's style, and everything seems to work fine.  There doesn't appear to be a need for the popup to be modal.  Do you remember why you did this originally?
Comment 4 Jeremy Dowdall CLA 2007-07-12 17:03:07 EDT
There was a bug in SWT where controls on a dialog would not generate any events when the dialog's parent was a modal dialog, unless it too was modal.  This meant that, while you could open and close the popup correctly, you could not interact with it at all.  So, I put in this hack to at least make the widget usable.
There's more history somewhere in bugzilla and on the SWT newsgroup, but that's the gist of it.
Comment 5 Nicolas Richeton CLA 2007-07-13 04:26:54 EDT
I checked Peter's fix on OSX, it works fine and pickers are usable. It seems that the workaround is no longer necessary. Can it be removed ?


Comment 6 Peter Centgraf CLA 2007-07-13 11:31:42 EDT
Jeremy, I've been unable to find the SWT bugzilla report for the modal dialog issue.  If you could point me to the right bug, I'll put in a conditional check for SWT.getVersion() < fix, so that it will continue to function (this bug notwithstanding) on older releases of SWT.

I think a reasonable, non-intrusive workaround for older SWT versions would be to commit changes from the popup when the Enter/Return keys are pressed.  CCombo has a similar behavior, as do standard Combos on Win32.  Personally, I'd like to have commit-on-enter anyway.
Comment 7 Peter Centgraf CLA 2007-07-31 16:43:34 EDT
HEAD now includes an SWT.getVersion() check.  Since I don't know exactly what SWT revision fixed the bug Jeremy mentioned, I'm using 3346, which is the current 3.3 final release.

This value is stored in a non-final protected static field, so that it is easier to test previous versions.  You can do so by creating a new subclass of CDateTime and simply assign this field the value of SWT.getVersion() in the constructor.  If events are delivered to the popup as expected, please let me know the value, and I will update it.  It would be particularly useful to know if this bug is still present in the 3.2 or 3.2.1 official releases.
Comment 8 Marco Maccaferri CLA 2008-06-02 09:21:09 EDT
I've recently hit this bug, I don't know if it is a regression or what, my SWT version is 3349 and it doesn't work. If I set SWT_MODAL_FIX_VERSION to 3400 the calendar works.

The widgets is placed on a page of an import wizard, if that matters.
Comment 9 Laurent CARON CLA 2019-09-14 13:55:56 EDT
Tried on latest SWT version, the bug seems to be fixed