d-widget-toolkit / org.eclipse.swt.win32.win32.x86

5 stars 6 forks source link

SWT.DROP_DOWN style has no effect on DateTime widget #16

Open jacob-carlborg opened 10 years ago

jacob-carlborg commented 10 years ago

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.

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]