]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/grid.cpp
fixed idle event generation logic (thanks to Paul Cornett for patch 1444602)
[wxWidgets.git] / src / generic / grid.cpp
index e27d34ae3e3563751781a3f8a67689fa7e00e29a..f6f5494bb00cb4937c3e661e50fb31af170edde1 100644 (file)
@@ -1159,20 +1159,25 @@ void wxGridCellFloatEditor::SetParameters(const wxString& params)
 wxString wxGridCellFloatEditor::GetString() const
 {
     wxString fmt;
-    if ( m_width == -1 )
-    {
-        // default width/precision
-        fmt = _T("%f");
-    }
-    else if ( m_precision == -1 )
+    if ( m_precision == -1 && m_width != -1)
     {
         // default precision
         fmt.Printf(_T("%%%d.f"), m_width);
     }
-    else
+    else if ( m_precision != -1 && m_width == -1)
+    {
+        // default width
+        fmt.Printf(_T("%%.%df"), m_precision);
+    }
+    else if ( m_precision != -1 && m_width != -1 )
     {
         fmt.Printf(_T("%%%d.%df"), m_width, m_precision);
     }
+    else
+    {
+        // default width/precision
+        fmt = _T("%f");
+    }
 
     return wxString::Format(fmt, m_valueOld);
 }
@@ -5816,7 +5821,7 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
         // Dragging on the corner of a cell to resize in both
         // directions is not implemented yet...
         //
-        if ( dragRow >= 0  &&  dragCol >= 0 )
+        if ( dragRow >= 0 && dragCol >= 0 )
         {
             ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL);
             return;
@@ -5831,16 +5836,8 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
                 if ( CanDragRowSize() && CanDragGridSize() )
                     ChangeCursorMode(WXGRID_CURSOR_RESIZE_ROW);
             }
-
-            if ( dragCol >= 0 )
-            {
-                m_dragRowOrCol = dragCol;
-            }
-
-            return;
         }
-
-        if ( dragCol >= 0 )
+        else if ( dragCol >= 0 )
         {
             m_dragRowOrCol = dragCol;
 
@@ -5849,15 +5846,13 @@ void wxGrid::ProcessGridCellMouseEvent( wxMouseEvent& event )
                 if ( CanDragColSize() && CanDragGridSize() )
                     ChangeCursorMode(WXGRID_CURSOR_RESIZE_COL);
             }
-
-            return;
         }
-
-        // Neither on a row or col edge
-        //
-        if ( m_cursorMode != WXGRID_CURSOR_SELECT_CELL )
+        else // Neither on a row or col edge
         {
-            ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL);
+            if ( m_cursorMode != WXGRID_CURSOR_SELECT_CELL )
+            {
+                ChangeCursorMode(WXGRID_CURSOR_SELECT_CELL);
+            }
         }
     }
 }