]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/grid.cpp
Ignore Windows key
[wxWidgets.git] / src / generic / grid.cpp
index 5a779c7682c4c96018eeb5f4eccaa830627c8cb5..46492505c69fc4a5526ba9f2c802dea030782b22 100644 (file)
@@ -3648,7 +3648,12 @@ bool wxGridStringTable::DeleteCols( size_t pos, size_t numCols )
 
     if ( !m_colLabels.IsEmpty() )
     {
-        m_colLabels.RemoveAt( colID, numCols );
+        // m_colLabels stores just as many elements as it needs, e.g. if only
+        // the label of the first column had been set it would have only one
+        // element and not numCols, so account for it
+        int nToRm = m_colLabels.size() - colID;
+        if ( nToRm > 0 )
+            m_colLabels.RemoveAt( colID, nToRm );
     }
 
     for ( row = 0; row < curNumRows; row++ )
@@ -4363,7 +4368,7 @@ bool wxGrid::SetTable( wxGridTableBase *table, bool takeOwnership,
         // stop all processing
         m_created = false;
 
-        if (m_table) 
+        if (m_table)
         {
             m_table->SetView(0);
             if( m_ownTable )
@@ -4401,7 +4406,7 @@ bool wxGrid::SetTable( wxGridTableBase *table, bool takeOwnership,
             // original one current cell and selection regions
             // might be invalid,
             m_selectingKeyboard = wxGridNoCellCoords;
-            m_currentCellCoords = 
+            m_currentCellCoords =
               wxGridCellCoords(wxMin(m_numRows, m_currentCellCoords.GetRow()),
                                wxMin(m_numCols, m_currentCellCoords.GetCol()));
             if (m_selectingTopLeft.GetRow() >= m_numRows ||
@@ -5921,13 +5926,6 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
                 SaveEditControlValue();
             }
 
-            // Have we captured the mouse yet?
-            if (! m_winCapture)
-            {
-                m_winCapture = m_gridWin;
-                m_winCapture->CaptureMouse();
-            }
-
             if ( coords != wxGridNoCellCoords )
             {
                 if ( event.CmdDown() )
@@ -5947,6 +5945,7 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
                                    coords.GetRow(),
                                    coords.GetCol(),
                                    event );
+                        return;
                     }
                 }
                 else
@@ -5968,6 +5967,14 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
                     // scrolling is way to fast, at least on MSW - also on GTK.
                 }
             }
+            // Have we captured the mouse yet?
+            if (! m_winCapture)
+            {
+                m_winCapture = m_gridWin;
+                m_winCapture->CaptureMouse();
+            }
+
+
         }
         else if ( m_cursorMode == WXGRID_CURSOR_RESIZE_ROW )
         {
@@ -6730,7 +6737,7 @@ int wxGrid::SendEvent( const wxEventType type,
            pos.y += GetColLabelSize();
        if ( mouseEv.GetEventObject() == GetGridColLabelWindow() )
            pos.x += GetRowLabelSize();
-       
+
        wxGridEvent gridEvt( GetId(),
                type,
                this,
@@ -6896,14 +6903,10 @@ void wxGrid::Refresh(bool eraseb, const wxRect* rect)
     }
 }
 
-void wxGrid::OnSize( wxSizeEvent& event )
+void wxGrid::OnSize(wxSizeEvent& WXUNUSED(event))
 {
-    // position the child windows
-    CalcWindowSizes();
-
-    // don't call CalcDimensions() from here, the base class handles the size
-    // changes itself
-    event.Skip();
+    // update our children window positions and scrollbars
+    CalcDimensions();
 }
 
 void wxGrid::OnKeyDown( wxKeyEvent& event )
@@ -6931,7 +6934,7 @@ void wxGrid::OnKeyDown( wxKeyEvent& event )
             else if (event.GetKeyCode() == WXK_LEFT)
                 event.m_keyCode = WXK_RIGHT;
         }
-    
+
         // try local handlers
         switch ( event.GetKeyCode() )
         {