Fixed EVT_TREE_SEL_CHANGED and _CHANGING under MSLU (patch 631815)
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 8 Dec 2002 13:23:03 +0000 (13:23 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 8 Dec 2002 13:23:03 +0000 (13:23 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18108 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/treectrl.cpp

index 75813b5bfb37c441aee510cfe71c8c861c3362c3..347ed299f51b1cd0b554b220af5b728433a24a99 100644 (file)
@@ -2397,20 +2397,34 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
             }
             break;
 
-        case TVN_SELCHANGED:
+        // NB: MSLU is broken and sends TVN_SELCHANGEDA instead of 
+        //     TVN_SELCHANGEDW in Unicode mode under Win98. Therefore
+        //     we have to handle both messages:
+        case TVN_SELCHANGEDA:
+        case TVN_SELCHANGEDW:
             eventType = wxEVT_COMMAND_TREE_SEL_CHANGED;
             // fall through
 
-        case TVN_SELCHANGING:
+        case TVN_SELCHANGINGA:
+        case TVN_SELCHANGINGW:
             {
                 if ( eventType == wxEVT_NULL )
                     eventType = wxEVT_COMMAND_TREE_SEL_CHANGING;
                 //else: already set above
 
-                NM_TREEVIEW* tv = (NM_TREEVIEW *)lParam;
-
-                event.m_item = (WXHTREEITEM) tv->itemNew.hItem;
-                event.m_itemOld = (WXHTREEITEM) tv->itemOld.hItem;
+                if (hdr->code == TVN_SELCHANGINGW || 
+                    hdr->code == TVN_SELCHANGEDW)
+                {
+                    NM_TREEVIEWW* tv = (NM_TREEVIEWW *)lParam;
+                    event.m_item = (WXHTREEITEM) tv->itemNew.hItem;
+                    event.m_itemOld = (WXHTREEITEM) tv->itemOld.hItem;
+                }
+                else
+                {
+                    NM_TREEVIEWA* tv = (NM_TREEVIEWA *)lParam;
+                    event.m_item = (WXHTREEITEM) tv->itemNew.hItem;
+                    event.m_itemOld = (WXHTREEITEM) tv->itemOld.hItem;
+                }
             }
             break;