]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/valgen.cpp
Apply patch that prevents a crash when more than
[wxWidgets.git] / src / common / valgen.cpp
index f6dc6d5202a9f6323160d74672ddef84b20e4758..e9aaf19e38386f7a6057edb67a8c58d319e26cee 100644 (file)
@@ -225,7 +225,7 @@ bool wxGenericValidator::TransferToWindow(void)
             {
                 pControl->SetStringSelection(* m_pString);
             }
-            else
+            if ((m_validatorWindow->GetWindowStyle() & wxCB_READONLY) == 0)
             {
                 pControl->SetValue(* m_pString);
             }
@@ -252,6 +252,7 @@ bool wxGenericValidator::TransferToWindow(void)
         }
     } else
 #endif
+#if wxUSE_STATTEXT
     if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) )
     {
         wxStaticText* pControl = (wxStaticText*) m_validatorWindow;
@@ -261,6 +262,7 @@ bool wxGenericValidator::TransferToWindow(void)
             return true;
         }
     } else
+#endif
 #if wxUSE_TEXTCTRL
     if (m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)) )
     {
@@ -450,7 +452,10 @@ bool wxGenericValidator::TransferFromWindow(void)
     }
     else if (m_pString)
     {
-        *m_pString = pControl->GetValue();
+        if (m_validatorWindow->GetWindowStyle() & wxCB_READONLY)
+            *m_pString = pControl->GetStringSelection();
+        else
+            *m_pString = pControl->GetValue();
         return true;
     }
   } else
@@ -471,6 +476,7 @@ bool wxGenericValidator::TransferFromWindow(void)
     }
   } else
 #endif
+#if wxUSE_STATTEXT
   if (m_validatorWindow->IsKindOf(CLASSINFO(wxStaticText)) )
   {
     wxStaticText* pControl = (wxStaticText*) m_validatorWindow;
@@ -480,6 +486,7 @@ bool wxGenericValidator::TransferFromWindow(void)
       return true;
     }
   } else
+#endif
 #if wxUSE_TEXTCTRL
   if (m_validatorWindow->IsKindOf(CLASSINFO(wxTextCtrl)) )
   {