Mercurial > projects > dwt-linux
diff dwt/widgets/Widget.d @ 120:d716ed170ef6
Fix: Widget getData/setData
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 20 Jan 2008 16:40:10 +0100 |
parents | 9ba02d7fb226 |
children | f2e04420fd6c |
line wrap: on
line diff
--- a/dwt/widgets/Widget.d Sat Jan 19 13:48:29 2008 +0100 +++ b/dwt/widgets/Widget.d Sun Jan 20 16:40:10 2008 +0100 @@ -582,9 +582,10 @@ checkWidget(); if (key is null) error (DWT.ERROR_NULL_ARGUMENT); if ((state & KEYED_DATA) !is 0) { - char[][] table = (cast(ArrayWrapperString2) data).array; + Object[] table = (cast(ArrayWrapperObject) data).array; for (int i=1; i<table.length; i+=2) { - if (key ==/*eq*/ table [i] ) return new ArrayWrapperString( table [i+1] ); + char[] tablekey = (cast(ArrayWrapperString) table[i]).array; + if (key ==/*eq*/ tablekey ) return table [i+1]; } } return null; @@ -1202,6 +1203,7 @@ eventTable.unhook (DWT.Dispose, listener); } + void sendEvent (Event event) { Display display = event.display; if (!display.filterEvent (event)) { @@ -1370,20 +1372,16 @@ */ public void setData (char[] key, Object value) { checkWidget(); - if (key is null) error (DWT.ERROR_NULL_ARGUMENT); + if (key.length is 0) error (DWT.ERROR_NULL_ARGUMENT); int index = 1; Object [] table = null; if ((state & KEYED_DATA) !is 0) { - auto arr = (cast(ArrayWrapperString2) data).array; - ArrayWrapperString[] strtable; - foreach( str; arr ){ - strtable ~= new ArrayWrapperString( str ); - } - while (index < strtable.length) { - if (key ==/*eq*/ strtable [index].array ) break; + table = (cast(ArrayWrapperObject) data).array; + while (index < table.length) { + char[] tablekey = (cast(ArrayWrapperString)table[index]).array; + if (key ==/*eq*/ tablekey ) break; index += 2; } - table = cast(Object[])strtable; } if (value !is null) { if ((state & KEYED_DATA) !is 0) {