]> git.saurik.com Git - wxWidgets.git/commitdiff
don't show the normal context menu while editing an item (#9543)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 7 Jun 2008 02:30:25 +0000 (02:30 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 7 Jun 2008 02:30:25 +0000 (02:30 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54011 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/listctrl/listtest.cpp

index a52d375dd641560c7f827d57983e31750e5a17d1..6d1422e2661d791342be22b92ac497eceaddc683 100644 (file)
@@ -1132,16 +1132,29 @@ void MyListCtrl::InsertItemInReportView(int i)
 #if USE_CONTEXT_MENU
 void MyListCtrl::OnContextMenu(wxContextMenuEvent& event)
 {
 #if USE_CONTEXT_MENU
 void MyListCtrl::OnContextMenu(wxContextMenuEvent& event)
 {
-    wxPoint point = event.GetPosition();
-    // If from keyboard
-    if (point.x == -1 && point.y == -1) {
-        wxSize size = GetSize();
-        point.x = size.x / 2;
-        point.y = size.y / 2;
-    } else {
-        point = ScreenToClient(point);
+    if (GetEditControl() == NULL)
+    {
+        wxPoint point = event.GetPosition();
+        // If from keyboard
+        if ( (point.x == -1) && (point.y == -1) )
+        {
+            wxSize size = GetSize();
+            point.x = size.x / 2;
+            point.y = size.y / 2;
+        }
+        else
+        {
+            point = ScreenToClient(point);
+        }
+        ShowContextMenu(point);
+    }
+    else
+    {
+        // the user is editing:
+        // allow the text control to display its context menu
+        // if it has one (it has on Windows) rather than display our one
+        event.Skip();
     }
     }
-    ShowContextMenu(point);
 }
 #endif
 
 }
 #endif