From defa9be268ed8ea8b18362e3d0ce690219e5a3d3 Mon Sep 17 00:00:00 2001 From: leo Date: Tue, 14 Feb 2006 06:06:28 +0000 Subject: Fixed empty search results not always shown. git-svn-id: http://svn.leocad.org/trunk@474 c7d43263-9d01-0410-8a33-9dba5d9f93d6 --- win/Piecebar.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'win/Piecebar.cpp') diff --git a/win/Piecebar.cpp b/win/Piecebar.cpp index f66cd2d..dae325f 100644 --- a/win/Piecebar.cpp +++ b/win/Piecebar.cpp @@ -1025,9 +1025,10 @@ BOOL CPiecesBar::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) CString CategoryName = m_PiecesTree.GetItemText(CategoryItem); int CategoryIndex = Lib->FindCategoryIndex((const char*)CategoryName); + PtrArray SinglePieces, GroupedPieces; + if (CategoryIndex != -1) { - PtrArray SinglePieces, GroupedPieces; int i; Lib->GetCategoryEntries(CategoryIndex, true, SinglePieces, GroupedPieces); @@ -1053,14 +1054,14 @@ BOOL CPiecesBar::OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult) m_PiecesTree.InsertItem(TVIF_CHILDREN|TVIF_PARAM|TVIF_TEXT, Info->m_strDescription, 0, 0, 0, 0, (LPARAM)Info, CategoryItem, TVI_LAST); } + } - if (CategoryName == "Search Results") + if (CategoryName == "Search Results") + { + // Let the user know if the search is empty. + if ((SinglePieces.GetSize() == 0) && (GroupedPieces.GetSize() == 0)) { - // Let the user know if the search is empty. - if ((SinglePieces.GetSize() == 0) && (GroupedPieces.GetSize() == 0)) - { - m_PiecesTree.InsertItem(TVIF_PARAM|TVIF_TEXT, "No pieces found", 0, 0, 0, 0, 0, CategoryItem, TVI_SORT); - } + m_PiecesTree.InsertItem(TVIF_PARAM|TVIF_TEXT, "No pieces found", 0, 0, 0, 0, 0, CategoryItem, TVI_SORT); } } } -- cgit v1.2.3