]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed assert warning if the listbox has no elements, we shouldn't try to set the...
authorGeorge Tasker <gtasker@allenbrook.com>
Wed, 12 May 2004 13:59:18 +0000 (13:59 +0000)
committerGeorge Tasker <gtasker@allenbrook.com>
Wed, 12 May 2004 13:59:18 +0000 (13:59 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27225 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

samples/db/listdb.cpp

index 89a795c70af5a11879d7aaecf5c12405db9b6d18..c95a3fc898638ba5a44def5101eeea7025c54600 100644 (file)
@@ -220,12 +220,12 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, wxChar *windowTitle, wxChar *tableName,
     while (lookup->GetNext())
         pLookUpSelectList->Append(lookup->lookupCol);
 
-    // Highlight the first list item
-    pLookUpSelectList->SetSelection(0);
-
     // Make the OK activate by pressing Enter
     if (pLookUpSelectList->GetCount())
+    {
+        pLookUpSelectList->SetSelection(0);
         pLookUpOkBtn->SetDefault();
+    }
     else
     {
         pLookUpCancelBtn->SetDefault();
@@ -380,12 +380,12 @@ ClookUpDlg::ClookUpDlg(wxWindow *parent, wxChar *windowTitle, wxChar *tableName,
         pLookUpSelectList->Append(s);
     }
 
-    // Highlight the first list item
-    pLookUpSelectList->SetSelection(0);
-
     // Make the OK activate by pressing Enter
     if (pLookUpSelectList->GetCount())
+    {
+        pLookUpSelectList->SetSelection(0);
         pLookUpOkBtn->SetDefault();
+    }
     else
     {
         pLookUpCancelBtn->SetDefault();