78
|
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 * D Port:
|
|
11 * Jesse Phillips <Jesse.K.Phillips+D> gmail.com
|
|
12 *******************************************************************************/
|
|
13 module snippets.combo.Snippet26;
|
|
14
|
|
15 /*
|
|
16 * Combo example snippet: create a combo box (non-editable)
|
|
17 *
|
|
18 * For a list of all DWT 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.Combo;
|
|
25
|
|
26 char[][] content = ["A", "B", "C"];
|
|
27
|
|
28 void main () {
|
|
29 auto display = new Display ();
|
|
30 auto shell = new Shell (display);
|
|
31 auto combo = new Combo (shell, DWT.READ_ONLY);
|
|
32 combo.setItems (content);
|
|
33 combo.setSize (200, 200);
|
|
34
|
|
35 shell.pack ();
|
|
36 shell.open ();
|
|
37 while (!shell.isDisposed ()) {
|
|
38 if (!display.readAndDispatch ()) display.sleep ();
|
|
39 }
|
|
40 display.dispose ();
|
|
41 }
|