1 |
// ResultDialog.cpp : implementation file |
/* |
2 |
// |
* Developed by Torben H. Nielsen |
3 |
|
*/ |
4 |
|
|
5 |
#include "stdafx.h" |
#include "stdafx.h" |
6 |
#include "h6-udlånssystem.h" |
#include "h6-udlånssystem.h" |
33 |
BEGIN_MESSAGE_MAP(ResultDialog, CDialog) |
BEGIN_MESSAGE_MAP(ResultDialog, CDialog) |
34 |
ON_WM_SETFOCUS() |
ON_WM_SETFOCUS() |
35 |
ON_BN_CLICKED(IDC_DETAILS, OnBnClickedDetails) |
ON_BN_CLICKED(IDC_DETAILS, OnBnClickedDetails) |
36 |
|
ON_NOTIFY(NM_DBLCLK, IDC_LIST, OnNMDblclkList) |
37 |
END_MESSAGE_MAP() |
END_MESSAGE_MAP() |
38 |
|
|
39 |
|
|
63 |
void ResultDialog::LoadResults(void) |
void ResultDialog::LoadResults(void) |
64 |
{ |
{ |
65 |
CListCtrl *list = (CListCtrl *) GetDlgItem(IDC_LIST); |
CListCtrl *list = (CListCtrl *) GetDlgItem(IDC_LIST); |
66 |
EquipmentVector result = CommonStorage::Instance()->getSearchResult(); |
vector<Equipment> result = CommonStorage::Instance()->getSearchResult(); |
67 |
|
|
68 |
CString count; |
CString count; |
69 |
count.Format("Found %d items", result.size()); |
count.Format("Found %d items", result.size()); |
105 |
{ |
{ |
106 |
CListCtrl *list = (CListCtrl *) GetDlgItem(IDC_LIST); |
CListCtrl *list = (CListCtrl *) GetDlgItem(IDC_LIST); |
107 |
int sel = list->GetSelectionMark(); |
int sel = list->GetSelectionMark(); |
108 |
|
CString barcode = list->GetItemText(sel,0); |
109 |
|
|
110 |
if (sel == -1) { |
if (sel == -1) { |
111 |
MessageBox("You must select an item"); |
MessageBox("You must select an item"); |
112 |
return; |
} else { |
113 |
|
ResultDetailsDialog resdialog; |
114 |
|
resdialog.m_barcode = barcode; |
115 |
|
|
116 |
|
resdialog.DoModal(); |
117 |
} |
} |
118 |
|
} |
119 |
|
|
120 |
|
void ResultDialog::OnNMDblclkList(NMHDR *pNMHDR, LRESULT *pResult) |
121 |
|
{ |
122 |
|
CListCtrl *list = (CListCtrl *) GetDlgItem(IDC_LIST); |
123 |
|
int sel = list->GetSelectionMark(); |
124 |
|
CString barcode = list->GetItemText(sel,0); |
125 |
|
|
126 |
ResultDetailsDialog resdialog; |
ResultDetailsDialog resdialog; |
127 |
resdialog.m_resultIndex = sel; |
resdialog.m_barcode = barcode; |
128 |
|
|
129 |
resdialog.DoModal(); |
resdialog.DoModal(); |
130 |
|
|
131 |
|
*pResult = 0; |
132 |
} |
} |