diff win/dw.c @ 1322:3f1ac800bf65

Initial fix for being able to do container string comparisons instead of pointer on all platforms. Improved on the GTK2 change earlier... where it would do both comparisons with string enabled.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Sun, 06 Nov 2011 12:13:13 +0000
parents c969db49606e
children 4c12170f003f
line wrap: on
line diff
--- a/win/dw.c	Sun Nov 06 11:48:24 2011 +0000
+++ b/win/dw.c	Sun Nov 06 12:13:13 2011 +0000
@@ -8491,6 +8491,7 @@
 void API dw_container_cursor(HWND handle, char *text)
 {
    int index = ListView_GetNextItem(handle, -1, LVNI_ALL);
+   int textcomp = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_textcomp"));
 
    while ( index != -1 )
    {
@@ -8503,7 +8504,7 @@
 
       ListView_GetItem( handle, &lvi );
 
-      if ( strcmp( (char *)lvi.lParam, text ) == 0 )
+      if ( (textcomp && lvi.lParam && strcmp( (char *)lvi.lParam, text ) == 0) || (!textcomp && (char *)lvi.lParam == text) )
       {
 
          ListView_SetItemState( handle, index, LVIS_FOCUSED | LVIS_SELECTED, LVIS_FOCUSED | LVIS_SELECTED );
@@ -8524,6 +8525,7 @@
 void API dw_container_delete_row(HWND handle, char *text)
 {
    int index = ListView_GetNextItem(handle, -1, LVNI_ALL);
+   int textcomp = DW_POINTER_TO_INT(dw_window_get_data(handle, "_dw_textcomp"));
 
    while(index != -1)
    {
@@ -8536,7 +8538,7 @@
 
       ListView_GetItem(handle, &lvi);
 
-      if ( strcmp( (char *)lvi.lParam, text ) == 0 )
+      if ( (textcomp && lvi.lParam && strcmp( (char *)lvi.lParam, text ) == 0) || (!textcomp && (char *)lvi.lParam == text) )
       {
          int _index = (int)dw_window_get_data(handle, "_dw_index");