DWT information, requirements and installation

History and packages:

  • DWT - the initial port of SWT (3.0.2) by Shawn Liu (from now on know as "old dwt"). Windows only, Phobos
  • Tioport – an attempt to port SWT automatically by Frank Benoit, Windows, Linux, Tango
  • DWT-Win/DWT-Linux - a new manual port of SWT (3.4) by Frank Benoit with help from John Reimer. This is the package you want. Windows, Linux, Tango
  • DWT-Addons – Ports of JFace functionality and other high-level stuff building on top of dwt. Builds upon DWT-Win/DWT-Linux
  • DWT-Samples - DWT examples and snippets. Perhaps additional tutorial sources. A wild growing examples collection. Builds upon DWT-Win/DWT-Linux

Ports available:

  • win32-win32-x86
  • gtk-linux-x86

Requirements:

Check the Requirements

Installation

Installation of DWT requires a D 1.x compiler, Tango and DSSS.

Mercurial is also recommended, but not required.

If you have all the prerequisites you can skip directly to step E. below.

A. Install D 1.x Compiler
There are several ways to get the D compiler. Two possible ways are:

  1. Download from DigitalMars (http://www.digitalmars.com/d/download.html) (See the Requirements for what version is know to be working)
  2. Download Tango bundled with DMD - http://www.dsource.org/projects/tango/wiki/DmdDownloads. Check if the bundled compiler is know to work (See Requirements). If you choose this option, obviously you can skip step B below, installing Tango.

    Hints on installing DMD:
  • Put the DMD files in a directory path without spaces
  • Put dmd/bin in some environment variable to be able to access DMD from the command line/terminal

B. Install Tango

Instructions for installing Tango are here: http://www.dsource.org/projects/tango/wiki/TopicInstallTango

C. Install DSSS

  1. Download latest DSSS - http://svn.dsource.org/projects/dsss/downloads/
  2. Unpack DSSS in directory path without spaces
  3. Put dsss/bin in some environment variable to be able to access DSSS from the command line/terminal
  4. Open dsss/etc/rebuild/default with a text editor
  5. Change to one of the following:
    • profile=dmd-win-tango
    • profile=dmd-posix-tango
  6. Change the oneatatime option in the DSSS compiler profile (dmd-win-tango or dmd-posix-tango) to oneatatime=off (twice) (Recommended for faster builds)

D. Install Mercurial

For more info see here - http://www.dsource.org/projects/dwt/wiki/AccessMercurialRepo

E. Install DWT

  1. In the command line/terminal change to the directory you want to download DWT to
  2. Download DWT by running from the command line one of the following commands:
         hg clone http://hg.dsource.org/projects/dwt-linux
         hg clone http://hg.dsource.org/projects/dwt-win
    
    You may also like to check out the growing repository of samples, which work with all versions of DWT.
         hg clone http://hg.dsource.org/projects/dwt-samples
    
    Automatically-generated snapshots of the latest source code are also available:
  3. (Windows only) Download some additional libraries and put them in dmd/lib - dwt-win-importlibs.zip
  4. In the command line/terminal, change into the newly created directory dwt-linux or dwt-win
  5. Run "dsss build" to build DWT

DWT has changed it build type to source library so if you want it to behave as previously (building a .lib/.a file) you have to open "dsss.conf" in the top directory of DWT and remove this: "type=sourcelibrary".

  1. Run "dsss install" to install DWT. After the installation process you should be able to build a dwt application with dsss anywhere in your system and you DON'T have to rename anything.

F. Testing your DWT installation

  1. You can test DWT with the following example (a similar example can be found in the dwt-samples project, dwtexamples/simple.d):
    module main;
    
    import dwt.widgets.Display;
    import dwt.widgets.Shell;
    
    void main ()
    {
        Display display = new Display;
        Shell shell = new Shell(display);
    
        shell.setText = "Hello DWT World";
    
        shell.open;
    
        while (!shell.isDisposed)
            if (!display.readAndDispatch)
                display.sleep;
    
        display.dispose;
    }
    
  2. Put the above code in a new file "main.d" into another directory
  3. Create a minimal file named "dsss.conf" in the same directory as above
    [main.d]
    

Windows only, optional add this line to "dsss.conf" to suppress the console window

buildflags+=-L/SUBSYSTEM:windows:5
  1. Run "dsss build" in the same directory as above
    In case you get linker errors verify that:
    • on windows, that the location of the import libs is known to dsss also. To be sure you can give that path to dsss with -S"path"
    • that you did "dsss install" after building dwt
  2. Run main



Further Information

Differences between SWT and DWT:

  • Change all package name from "org.eclipse.swt" to "dwt".
  • Change every "SWT" to "DWT".
  • Examples:
    • "org.eclipse.swt.widgets.Button" becomes "dwt.widgets.Button",
    • "org.eclipse.swt.SWT" becomes "dwt.DWT".


Things added or changed in DWT:

  • MessageBox can have null as parent to allow a MessageBox without a Shell
  • There are five new static methods in MessageBox:
    • showMessageBox
    • showInfo
    • showInformation (an alias to showInfo)
    • showWarning
    • showError
  • Not everything has been ported yet.


API documentation:
The SWT API documentation works for DWT with minor changes:
http://help.eclipse.org/stable/nftopic/org.eclipse.platform.doc.isv/reference/api/overview-summary.html

Snippets and examples: The SWT snippets and examples work for DWT with minor changes: