]> git.saurik.com Git - wxWidgets.git/commitdiff
don't assert when creating an initially empty wxCB_READONLY combobox
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 9 Feb 2004 22:30:47 +0000 (22:30 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 9 Feb 2004 22:30:47 +0000 (22:30 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25693 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/combobox.cpp

index 4c07746705b74087975651a99d37dc8f31a95f5a..2e6715a7e0c1e7d33f06671eb77c9ea4fbda8a12 100644 (file)
@@ -399,7 +399,10 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id,
                         validator, name) )
         return FALSE;
 
-    SetValue(value);
+    // we shouldn't call SetValue() for an empty read only combobox as it would
+    // (correctly) thro an assert and is otherwise useless anyhow
+    if ( n || !HasFlag(wxCB_READONLY) )
+        SetValue(value);
 
     // a (not read only) combobox is, in fact, 2 controls: the combobox itself
     // and an edit control inside it and if we want to catch events from this