view simple.d @ 202:1d129e5f6aa6

extend PrintStackTrace
author Frank Benoit <benoit@tionex.de>
date Sat, 12 Apr 2008 17:50:15 +0200
parents 43c42c637c9c
children
line wrap: on
line source

module simple;

import dwt.DWT;
import dwt.widgets.Display;
import dwt.widgets.Shell;
import dwt.widgets.Button;
import dwt.widgets.Text;

import tango.io.Stdout;
import tango.util.log.Trace;
import tango.math.Math;
import tango.text.convert.Format;
import tango.util.Convert;
import tango.util.PathUtil;
import dwt.events.SelectionListener;
import dwt.events.SelectionEvent;


import dwt.DWT;
import dwt.widgets.Display;

void main(){

    try{
        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setSize(300, 200);
        shell.setText("Simple DWT Sample");
        auto btn = new Button( shell, DWT.PUSH );
        btn.setBounds(40, 50, 100, 50);
        btn.setText( "hey" );

        auto txt = new Text(shell, DWT.BORDER);
        txt.setBounds(170, 50, 100, 40);

        btn.addSelectionListener(new class () SelectionListener {
            public void widgetSelected(SelectionEvent event) {
                txt.setText("No problem");
            }
            public void widgetDefaultSelected(SelectionEvent event) {
                txt.setText("No worries!");
            }
        });

        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
    }
    catch (Exception e) {
        Stdout.formatln ( "'{}', {}:{}", e.toString, e.file, e.line );
    }
}