]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/listctrl.cpp
really fixed wxMenuBar::Remove (bug 610850): reverted incorrect patch 649599 and...
[wxWidgets.git] / src / generic / listctrl.cpp
index 32f5bd7060a3ed120cd45c8ef0414ff191abfc8e..6e989ae648d2f18c2d5c2ca56b0697a0ddcfef08 100644 (file)
@@ -2074,12 +2074,14 @@ void wxListTextCtrl::OnChar( wxKeyEvent &event )
     switch ( event.m_keyCode )
     {
         case WXK_RETURN:
-            if ( !AcceptChanges() )
+            if ( AcceptChanges() )
             {
-                // vetoed by the user code
-                break;
+                // Close the text control, changes were accepted
+                Finish();
             }
-            //else: fall through
+            // else do nothing, do not accept and do not close
+
+            break;
 
         case WXK_ESCAPE:
             Finish();
@@ -4290,17 +4292,18 @@ long wxListMainWindow::FindItem(long start, long data)
 
 long wxListMainWindow::FindItem( const wxPoint& pt )
 {
-  wxPoint p;
-  long topItem = GetTopItem();
+    size_t topItem;
+    GetVisibleLinesRange(&topItem, NULL);
 
-  GetItemPosition( GetItemCount()-1, p );
-  if( p.y == 0 )
-    return topItem;
-  long id = (long) floor( pt.y*(GetItemCount()-topItem-1)/p.y+topItem );
-  if( id >= 0 && id < (long)GetItemCount() )
-    return id;
+    wxPoint p;
+    GetItemPosition( GetItemCount()-1, p );
+    if( p.y == 0 )
+        return topItem;
+    long id = (long) floor( pt.y*(GetItemCount()-topItem-1)/p.y+topItem );
+    if( id >= 0 && id < (long)GetItemCount() )
+        return id;
 
-  return wxNOT_FOUND;
+    return wxNOT_FOUND;
 }
 
 long wxListMainWindow::HitTest( int x, int y, int &flags )