Mercurial > projects > dwt-samples
comparison snippets/button/Snippet293.d @ 117:8cdaac0dc743
Added more snippets from TomD
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 12 Jul 2008 20:09:06 +0200 |
parents | 4a04b6759f98 |
children |
comparison
equal
deleted
inserted
replaced
116:f53c6274734f | 117:8cdaac0dc743 |
---|---|
8 * Contributors: | 8 * Contributors: |
9 * IBM Corporation - initial API and implementation | 9 * IBM Corporation - initial API and implementation |
10 * D Port: | 10 * D Port: |
11 * Jesse Phillips <Jesse.K.Phillips+D> gmail.com | 11 * Jesse Phillips <Jesse.K.Phillips+D> gmail.com |
12 *******************************************************************************/ | 12 *******************************************************************************/ |
13 module snippets.button.Snippet293; | 13 module button.Snippet293; |
14 | 14 |
15 /* | 15 /* |
16 * create a tri-state button. | 16 * create a tri-state button. |
17 * | 17 * |
18 * For a list of all SWT example snippets see | 18 * For a list of all SWT example snippets see |
23 import dwt.widgets.Display; | 23 import dwt.widgets.Display; |
24 import dwt.widgets.Shell; | 24 import dwt.widgets.Shell; |
25 import dwt.widgets.Button; | 25 import dwt.widgets.Button; |
26 | 26 |
27 void main() { | 27 void main() { |
28 auto display = new Display(); | 28 auto display = new Display(); |
29 auto shell = new Shell(display); | 29 auto shell = new Shell(display); |
30 shell.setLayout(new GridLayout()); | 30 shell.setLayout(new GridLayout()); |
31 | |
32 auto b1 = new Button (shell, DWT.CHECK); | |
33 b1.setText("State 1"); | |
34 b1.setSelection(true); | |
35 | |
36 auto b2 = new Button (shell, DWT.CHECK); | |
37 b2.setText("State 2"); | |
38 b2.setSelection(false); | |
39 | |
40 auto b3 = new Button (shell, DWT.CHECK); | |
41 b3.setText("State 3"); | |
42 b3.setSelection(true); | |
43 | 31 |
44 // This function does not appear in the api for swt 3.3 | 32 auto b1 = new Button (shell, DWT.CHECK); |
45 // b3.setGrayed(true); | 33 b1.setText("State 1"); |
46 | 34 b1.setSelection(true); |
47 shell.pack(); | 35 |
48 shell.open(); | 36 auto b2 = new Button (shell, DWT.CHECK); |
49 while (!shell.isDisposed()) { | 37 b2.setText("State 2"); |
50 if (!display.readAndDispatch()) | 38 b2.setSelection(false); |
51 display.sleep(); | 39 |
52 } | 40 auto b3 = new Button (shell, DWT.CHECK); |
53 display.dispose(); | 41 b3.setText("State 3"); |
42 b3.setSelection(true); | |
43 | |
44 // This function does not appear in the api for swt 3.3 | |
45 // b3.setGrayed(true); | |
46 | |
47 shell.pack(); | |
48 shell.open(); | |
49 while (!shell.isDisposed()) { | |
50 if (!display.readAndDispatch()) | |
51 display.sleep(); | |
52 } | |
53 display.dispose(); | |
54 } | 54 } |