--- ResultDialog.cpp 2006/09/03 09:19:06 30 +++ ResultDialog.cpp 2006/09/12 09:09:30 54 @@ -1,5 +1,6 @@ -// ResultDialog.cpp : implementation file -// +/* + * Developed by Torben H. Nielsen + */ #include "stdafx.h" #include "h6-udlånssystem.h" @@ -32,6 +33,7 @@ BEGIN_MESSAGE_MAP(ResultDialog, CDialog) ON_WM_SETFOCUS() ON_BN_CLICKED(IDC_DETAILS, OnBnClickedDetails) + ON_NOTIFY(NM_DBLCLK, IDC_LIST, OnNMDblclkList) END_MESSAGE_MAP() @@ -61,7 +63,7 @@ void ResultDialog::LoadResults(void) { CListCtrl *list = (CListCtrl *) GetDlgItem(IDC_LIST); - EquipmentVector result = CommonStorage::Instance()->getSearchResult(); + vector result = CommonStorage::Instance()->getSearchResult(); CString count; count.Format("Found %d items", result.size()); @@ -103,13 +105,28 @@ { CListCtrl *list = (CListCtrl *) GetDlgItem(IDC_LIST); int sel = list->GetSelectionMark(); + CString barcode = list->GetItemText(sel,0); if (sel == -1) { MessageBox("You must select an item"); } else { ResultDetailsDialog resdialog; - resdialog.m_resultIndex = sel; + resdialog.m_barcode = barcode; resdialog.DoModal(); } } + +void ResultDialog::OnNMDblclkList(NMHDR *pNMHDR, LRESULT *pResult) +{ + CListCtrl *list = (CListCtrl *) GetDlgItem(IDC_LIST); + int sel = list->GetSelectionMark(); + CString barcode = list->GetItemText(sel,0); + + ResultDetailsDialog resdialog; + resdialog.m_barcode = barcode; + + resdialog.DoModal(); + + *pResult = 0; +}