]> git.saurik.com Git - wxWidgets.git/commitdiff
Allow width to be absent but precision present
authorJulian Smart <julian@anthemion.co.uk>
Tue, 7 Mar 2006 14:50:50 +0000 (14:50 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Tue, 7 Mar 2006 14:50:50 +0000 (14:50 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37854 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/generic/grid.cpp

index e27d34ae3e3563751781a3f8a67689fa7e00e29a..a3f581189323a96d69225a9e1ab37322620bd00f 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);
 }