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()); |
104 |
void ResultDialog::OnBnClickedDetails() |
void ResultDialog::OnBnClickedDetails() |
105 |
{ |
{ |
106 |
CListCtrl *list = (CListCtrl *) GetDlgItem(IDC_LIST); |
CListCtrl *list = (CListCtrl *) GetDlgItem(IDC_LIST); |
107 |
int sel = list->GetSelectionMark(); |
if (list->GetItemCount() > 0) { |
108 |
|
|
109 |
|
int sel = list->GetSelectionMark(); |
110 |
|
CString barcode = list->GetItemText(sel,0); |
111 |
|
|
112 |
|
if (sel == -1) { |
113 |
|
MessageBox("You must select an item"); |
114 |
|
} else { |
115 |
|
ResultDetailsDialog resdialog; |
116 |
|
resdialog.m_barcode = barcode; |
117 |
|
|
118 |
|
resdialog.DoModal(); |
119 |
|
} |
120 |
|
} |
121 |
|
} |
122 |
|
|
123 |
|
void ResultDialog::OnNMDblclkList(NMHDR *pNMHDR, LRESULT *pResult) |
124 |
|
{ |
125 |
|
CListCtrl *list = (CListCtrl *) GetDlgItem(IDC_LIST); |
126 |
|
if (list->GetItemCount() > 0) { |
127 |
|
int sel = list->GetSelectionMark(); |
128 |
|
CString barcode = list->GetItemText(sel,0); |
129 |
|
|
|
if (sel == -1) { |
|
|
MessageBox("You must select an item"); |
|
|
} else { |
|
130 |
ResultDetailsDialog resdialog; |
ResultDetailsDialog resdialog; |
131 |
resdialog.m_resultIndex = sel; |
resdialog.m_barcode = barcode; |
132 |
|
|
133 |
resdialog.DoModal(); |
resdialog.DoModal(); |
134 |
} |
} |
135 |
|
|
136 |
|
*pResult = 0; |
137 |
} |
} |