]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/treectrl.cpp
Added m_nSelection = -1 fixes to RemovePage, DeleteAllPages (from Scott Newham)
[wxWidgets.git] / src / msw / treectrl.cpp
index b94bb87d8d00f27e4f9f5dc1385334b9e8b845b4..aebe08ac3959d08b6d478bd7a7dd10abcd8f2bf9 100644 (file)
@@ -315,10 +315,10 @@ bool wxTreeCtrl::Create(wxWindow *parent,
     if ( m_windowStyle & wxTR_LINES_AT_ROOT )
         wstyle |= TVS_LINESATROOT;
 
-#if !defined( __GNUWIN32__ ) && !defined( __BORLANDC__ ) && !defined(wxUSE_NORLANDER_HEADERS)
+#if !defined( __GNUWIN32__ ) && !defined( __BORLANDC__ ) && !defined( __WATCOMC__ ) && !defined(wxUSE_NORLANDER_HEADERS)
     // we emulate the multiple selection tree controls by using checkboxes: set
     // up the image list we need for this if we do have multiple selections
-#if !defined(__VISUALC__) || (__VISUALC__ != 1010)
+#if !defined(__VISUALC__) || (__VISUALC__ > 1010)
     if ( m_windowStyle & wxTR_MULTIPLE )
         wstyle |= TVS_CHECKBOXES;
 #endif
@@ -1348,22 +1348,24 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
     switch ( hdr->code )
     {
         case NM_RCLICK:
-       {
-           if ( wxControl::MSWOnNotify(idCtrl, lParam, result) )
-               return TRUE;
-           
-           TV_HITTESTINFO tvhti;
-           ::GetCursorPos(&(tvhti.pt));
-           ::ScreenToClient(GetHwnd(),&(tvhti.pt));
-           if ((HTREEITEM) TreeView_HitTest(GetHwnd(),&tvhti) != (HTREEITEM) NULL) {
-               if (tvhti.flags & TVHT_ONITEM) {
-                   event.m_item = (WXHTREEITEM) tvhti.hItem;
-                   eventType=wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK;
-               }
-           }
-           break;
-       }
-       
+        {
+            if ( wxControl::MSWOnNotify(idCtrl, lParam, result) )
+                return TRUE;
+
+            TV_HITTESTINFO tvhti;
+            ::GetCursorPos(&(tvhti.pt));
+            ::ScreenToClient(GetHwnd(),&(tvhti.pt));
+            if ( TreeView_HitTest(GetHwnd(),&tvhti) )
+            {
+                if( tvhti.flags & TVHT_ONITEM )
+                {
+                    event.m_item = (WXHTREEITEM) tvhti.hItem;
+                    eventType=wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK;
+                }
+            }
+            break;
+        }
+
         case TVN_BEGINDRAG:
             eventType = wxEVT_COMMAND_TREE_BEGIN_DRAG;
             // fall through
@@ -1407,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;
             }