]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/propgrid/sampleprops.cpp
Added virtual wxPGProperty::ValueToString(). In derived property classes, now it...
[wxWidgets.git] / samples / propgrid / sampleprops.cpp
index 8216a7eb67bc78d3ef42a3f289277bf1ade6f5e1..5791ebae837293d458478d38d7bec75872f66dbe 100644 (file)
@@ -513,16 +513,29 @@ wxArrayDoubleProperty::~wxArrayDoubleProperty () { }
 
 void wxArrayDoubleProperty::OnSetValue()
 {
+    // Generate cached display string, to optimize grid drawing
     GenerateValueAsString( m_display, m_precision, true );
 }
 
-wxString wxArrayDoubleProperty::GetValueAsString( int arg_flags ) const
+wxString wxArrayDoubleProperty::ValueToString( wxVariant& value,
+                                               int argFlags ) const
 {
-    if ( !(arg_flags & wxPG_FULL_VALUE ))
-        return m_display;
-
     wxString s;
-    GenerateValueAsString(s,-1,false);
+
+    if ( argFlags & wxPG_FULL_VALUE )
+    {
+        GenerateValueAsString(s,-1,false);
+    }
+    else
+    {
+        //
+        // Display cached string only if value truly matches m_value
+        if ( value.GetData() == m_value.GetData() )
+            return m_display;
+        else
+            GenerateValueAsString( s, m_precision, true );
+    }
+
     return s;
 }