diff snippets/display/Snippet60.d @ 132:104f5ed240fc

More snippets from TomD, thanks!
author Frank Benoit <benoit@tionex.de>
date Tue, 29 Jul 2008 01:50:10 +0200
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/snippets/display/Snippet60.d	Tue Jul 29 01:50:10 2008 +0200
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * 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 display.Snippet60;
+
+/*
+ * Display example snippet: create two one shot timers (5000 ms, 2000 ms)
+ *
+ * For a list of all DWT example snippets see
+ * http://www.eclipse.org/swt/snippets/
+ */
+import dwt.widgets.Display;
+import dwt.widgets.Shell;
+
+import dwt.dwthelper.utils;
+import dwt.dwthelper.Runnable;
+
+import tango.io.Stdout;
+
+void main (String [] args) {
+    Display display = new Display ();
+    Shell shell = new Shell (display);
+    shell.setSize (200, 200);
+    shell.open ();
+    display.timerExec (5000, dgRunnable({
+        Stdout("5000\n").flush();
+    }));
+    display.timerExec (2000, dgRunnable({
+        Stdout("2000\n").flush();
+    }));
+    while (!shell.isDisposed ()) {
+        if (!display.readAndDispatch ()) display.sleep ();
+    }
+    display.dispose ();
+}
+