From ae883e9aee748e49db6266a58798bd24154703f2 Mon Sep 17 00:00:00 2001 From: George Tasker Date: Wed, 12 May 2004 13:59:18 +0000 Subject: [PATCH] Fixed assert warning if the listbox has no elements, we shouldn't try to set the selection to the first line git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@27225 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/db/listdb.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/samples/db/listdb.cpp b/samples/db/listdb.cpp index 89a795c70a..c95a3fc898 100644 --- a/samples/db/listdb.cpp +++ b/samples/db/listdb.cpp @@ -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(); -- 2.47.2