Under Windows 7 64bit Enterprise the SWT.DROP_DOWN style has no effect on the DateTime widget. The widget does not show the date in a combo box with a dropdown button. It shows in the default with the up/down spin buttons that are found on the Spin widget.

Below is a slightly modified version of Snippet250 to test out this issue.

/*******************************************************************************
 * Copyright (c) 2000, 2004 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 * D Port:
 *     Thomas Demmer <t_demmer AT web DOT de>
*******************************************************************************/
module org.eclipse.swt.snippets.Snippet250;

/*
* DateTime example snippet: create a DateTime calendar and a DateTime time.
 *
 * For a list of all SWT example snippets see
 * http://www.eclipse.org/swt/snippets/
 */
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.DateTime;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

import java.lang.all;

version(Tango){
    import tango.io.Stdout;
} else { // Phobos
    import std.stdio;
}

void main () {
    Display display = new Display ();
    Shell shell = new Shell (display);
    shell.setLayout (new RowLayout ());

    DateTime calendar = new DateTime (shell, SWT.CALENDAR);
    calendar.addSelectionListener (new class SelectionAdapter{
        override
        void widgetSelected (SelectionEvent e) {
            version(Tango){
                Stdout("calendar date changed\n");
                Stdout.flush();
            } else { // Phobos
                writeln("calendar date changed");
            }
        }
    });

DateTime date = new DateTime (shell, SWT.BORDER | SWT.DATE | SWT.DROP_DOWN);
    date.addSelectionListener (new class SelectionAdapter{
        override
        void widgetSelected (SelectionEvent e) {
            version(Tango){
                Stdout("date changed\n");
                Stdout.flush();
            } else { // Phobos
                writeln("date changed");
            }
        }
    }); 
    DateTime time = new DateTime (shell, SWT.TIME);
    time.addSelectionListener (new class SelectionAdapter{
        override
        void widgetSelected (SelectionEvent e) {
            version(Tango){
                Stdout("time changed\n");
                Stdout.flush();
            } else { // Phobos
                writeln("time changed");
            }
        }
    });

    shell.pack ();
    shell.open ();
    while (!shell.isDisposed ()) {
        if (!display.readAndDispatch ()) display.sleep ();
    }
    display.dispose ();
}


I have tried it with and without the border even tried it with just SWT.DROP_DOWN style and that did not work either. This is not a critical issue I just wanted to bring it to someones attention. I am not sure what version of SWT DWT is based on these days so I don't know what version of DWT I have. I just downloaded a fresh copy of DWT a couple of weeks ago.

I am using dmd v2.064 and rdmd build 20131011

I compiled the code above with the following line from my install of dwt directory.

rdmd build swtsnippets[Snippet250]

Reply via email to