comparison examples/addressbook/AddressBook.d @ 82:9c2803aea121

Fix Addressbook example and HG ignores
author Frank Benoit <benoit@tionex.de>
date Mon, 12 May 2008 16:29:26 +0200
parents 8a1930f94cbb
children cfd5fa2ce475
comparison
equal deleted inserted replaced
81:931cabfa238f 82:9c2803aea121
43 43
44 import examples.addressbook.SearchDialog; 44 import examples.addressbook.SearchDialog;
45 import examples.addressbook.DataEntryDialog; 45 import examples.addressbook.DataEntryDialog;
46 import examples.addressbook.FindListener; 46 import examples.addressbook.FindListener;
47 47
48 version(JIVE){
49 import jive.stacktrace;
50 }
48 void main() { 51 void main() {
49 Display display = new Display(); 52 Display display = new Display();
50 auto application = new AddressBook(); 53 auto application = new AddressBook();
51 Shell shell = application.open(display); 54 Shell shell = application.open(display);
52 while(!shell.isDisposed()){ 55 while(!shell.isDisposed()){
106 } 109 }
107 }); 110 });
108 111
109 createMenuBar(); 112 createMenuBar();
110 113
111 searchDialog = new SearchDialog(shell); 114 searchDialog = new SearchDialog(shell, resAddressBook );
112 searchDialog.setSearchAreaNames(columnNames); 115 searchDialog.setSearchAreaNames(columnNames);
113 searchDialog.setSearchAreaLabel(resAddressBook.getString("Column")); 116 searchDialog.setSearchAreaLabel(resAddressBook.getString("Column"));
114 searchDialog.addFindListener(new class() FindListener { 117 searchDialog.addFindListener(new class() FindListener {
115 public bool find() { 118 public bool find() {
116 return findEntry(); 119 return findEntry();
202 MessageBox box = new MessageBox(shell, DWT.ICON_ERROR); 205 MessageBox box = new MessageBox(shell, DWT.ICON_ERROR);
203 box.setMessage(msg); 206 box.setMessage(msg);
204 box.open(); 207 box.open();
205 } 208 }
206 private void editEntry(TableItem item) { 209 private void editEntry(TableItem item) {
207 DataEntryDialog dialog = new DataEntryDialog(shell); 210 DataEntryDialog dialog = new DataEntryDialog(shell, resAddressBook );
208 dialog.setLabels(columnNames); 211 dialog.setLabels(columnNames);
209 char[][] values = new char[][table.getColumnCount()]; 212 char[][] values = new char[][table.getColumnCount()];
210 for (int i = 0; i < values.length; i++) { 213 for (int i = 0; i < values.length; i++) {
211 values[i] = item.getText(i); 214 values[i] = item.getText(i);
212 } 215 }
281 *(cast(Object*)&file) = null; 284 *(cast(Object*)&file) = null;
282 ///cast(Object)file = null; 285 ///cast(Object)file = null;
283 isModified = false; 286 isModified = false;
284 } 287 }
285 private void newEntry() { 288 private void newEntry() {
286 DataEntryDialog dialog = new DataEntryDialog(shell); 289 DataEntryDialog dialog = new DataEntryDialog(shell, resAddressBook);
287 dialog.setLabels(columnNames); 290 dialog.setLabels(columnNames);
288 char[][] data = dialog.open(); 291 char[][] data = dialog.open();
289 if (data !is null) { 292 if (data !is null) {
290 TableItem item = new TableItem(table, DWT.NONE); 293 TableItem item = new TableItem(table, DWT.NONE);
291 item.setText(data); 294 item.setText(data);