comparison snippets/filedialog/Snippet72.d @ 78:4a04b6759f98

Clean up directory names
author John Reimer <terminal.node@gmail.com>
date Sat, 10 May 2008 13:32:45 -0700
parents
children 1f0a7a472680
comparison
equal deleted inserted replaced
76:04f122e90b0a 78:4a04b6759f98
1 /*******************************************************************************
2 * Copyright (c) 2000, 2004 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 * Port to the D programming language:
11 * Bill Baxter <bill@billbaxter.com>
12 *******************************************************************************/
13 module snippets.filedialog.Snippet72;
14
15 /*
16 * FileDialog example snippet: prompt for a file name (to save)
17 *
18 * For a list of all SWT example snippets see
19 * http://www.eclipse.org/swt/snippets/
20 */
21 import dwt.DWT;
22 import dwt.widgets.Display;
23 import dwt.widgets.Shell;
24 import dwt.widgets.FileDialog;
25
26 import tango.io.Stdout;
27
28 void main () {
29 Display display = new Display ();
30 Shell shell = new Shell (display);
31 shell.open ();
32 FileDialog dialog = new FileDialog (shell, DWT.SAVE);
33 dialog.setFilterNames (["Batch Files", "All Files (*.*)"]);
34 dialog.setFilterExtensions (["*.bat", "*.*"]); //Windows wild cards
35 dialog.setFilterPath ("c:\\"); //Windows path
36 dialog.setFileName ("fred.bat");
37 Stdout.formatln ("Save to: {}", dialog.open ());
38 while (!shell.isDisposed ()) {
39 if (!display.readAndDispatch ()) display.sleep ();
40 }
41 display.dispose ();
42 }
43