]> git.saurik.com Git - wxWidgets.git/commitdiff
end label edit patch from Ricky Gonzales <gonzales@pyramid3.net>
authorVadim Zeitlin <vadim@wxwidgets.org>
Tue, 2 Nov 1999 16:05:25 +0000 (16:05 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Tue, 2 Nov 1999 16:05:25 +0000 (16:05 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4303 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/listctrl.cpp
src/msw/treectrl.cpp

index d49a2877453a5a14b3eb37a67261d4ab9f47fda9..2cbde7df5b177687c282fa4d43ded188fadbcd35 100644 (file)
@@ -1256,9 +1256,9 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
             {
                 eventType = wxEVT_COMMAND_LIST_END_LABEL_EDIT;
                 LV_DISPINFO *info = (LV_DISPINFO *)lParam;
-                wxConvertFromMSWListItem(this, event.m_item, info->item, GetHwnd());
+                wxConvertFromMSWListItem(this, event.m_item, info->item);
                 if ( info->item.pszText == NULL || info->item.iItem == -1 )
-                    event.m_cancelled = TRUE;
+                    return FALSE;
                 break;
             }
         case LVN_GETDISPINFO:
@@ -1341,7 +1341,11 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
             }
 
             // else translate it into wxEVT_COMMAND_LIST_ITEM_ACTIVATED event
-            eventType = wxEVT_COMMAND_LIST_ITEM_ACTIVATED;
+            {
+                eventType = wxEVT_COMMAND_LIST_ITEM_ACTIVATED;
+                NM_LISTVIEW* hdr = (NM_LISTVIEW*)lParam;
+                event.m_itemIndex = hdr->iItem;
+            }
             break;
 
         case NM_RCLICK:
@@ -1417,18 +1421,29 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
     if ( !GetEventHandler()->ProcessEvent(event) )
         return FALSE;
 
-    if ( (int)hdr1->code == LVN_GETDISPINFO)
+    switch ((int)hdr1->code)
     {
-        LV_DISPINFO *info = (LV_DISPINFO *)lParam;
-        if ( info->item.mask & LVIF_TEXT )
-        {
-            if ( !event.m_item.m_text.IsNull() )
+        case LVN_GETDISPINFO:
             {
-                info->item.pszText = AddPool(event.m_item.m_text);
-                info->item.cchTextMax = wxStrlen(info->item.pszText) + 1;
+                LV_DISPINFO *info = (LV_DISPINFO *)lParam;
+                if ( info->item.mask & LVIF_TEXT )
+                {
+                    if ( !event.m_item.m_text.IsNull() )
+                    {
+                        info->item.pszText = AddPool(event.m_item.m_text);
+                        info->item.cchTextMax = wxStrlen(info->item.pszText) + 1;
+                    }
+                }
+                //    wxConvertToMSWListItem(this, event.m_item, info->item);
+                break;
             }
-        }
-        //    wxConvertToMSWListItem(this, event.m_item, info->item);
+        case LVN_ENDLABELEDIT:
+            {
+                *result = event.IsAllowed();
+                return TRUE;
+            }
+        default:
+            break;
     }
 
     *result = !event.IsAllowed();
index f1cfce1fd9ecb912ea83b5aeb8a0619fff8d4d05..4444b261809175d10dad0fcdcb9c3c8b64d4360c 100644 (file)
@@ -1409,6 +1409,8 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
 
                 event.m_item = (WXHTREEITEM)info->item.hItem;
                 event.m_label = info->item.pszText;
+                if (info->item.pszText == NULL)
+                    return FALSE;
                 break;
             }