From: Vadim Zeitlin Date: Sat, 7 Jun 2008 02:30:25 +0000 (+0000) Subject: don't show the normal context menu while editing an item (#9543) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/d53b09d870a75f9d585dd710f823f72c1eb02420?ds=inline don't show the normal context menu while editing an item (#9543) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54011 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/samples/listctrl/listtest.cpp b/samples/listctrl/listtest.cpp index a52d375dd6..6d1422e266 100644 --- a/samples/listctrl/listtest.cpp +++ b/samples/listctrl/listtest.cpp @@ -1132,16 +1132,29 @@ void MyListCtrl::InsertItemInReportView(int i) #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