void CLabelTypeDialog::BuildList(void) { int nType = IsDlgButtonChecked(IDC_LABEL_TYPE_LASER) ? CPaperInfo::PAPER_CutSheet : CPaperInfo::PAPER_Continuous; /* // Get the name to match. */ CString csOldName; if (m_pOldInfo != NULL) { csOldName = m_pOldInfo->GetName(); } int nNewSel = 0; CListBox* pList; if ((pList = (CListBox*)GetDlgItem(IDC_LABEL_LIST)) != NULL) { pList->SetRedraw(FALSE); pList->ResetContent(); int nLabels = m_List.Labels(); for (int nLabel = 0; nLabel < nLabels; nLabel++) { CLabelData* pLabel = m_List.Label(nLabel); ASSERT(pLabel != NULL); if (pLabel != NULL && pLabel->Type() == nType) { int nIndex = pList->AddString(pLabel->GetName()); if (nIndex >= 0) { pList->SetItemData(nIndex, (DWORD)pLabel); if (pLabel->GetName() == csOldName) { nNewSel = nIndex; } } } } /* // Set the initial entry as necessary. */ if (pList->GetCount() > 0) { pList->SetCurSel(nNewSel); OnSelchangeLabelList(); } pList->SetRedraw(TRUE); } }
void CPhotoProjectsTypeDlg::BuildList(void) { /* // Get the name to match. */ CString csOldName; if (m_pOldInfo != NULL) { csOldName = m_pOldInfo->GetName(); } int nNewSel = 0; CListBox* pList; if ((pList = (CListBox*)GetDlgItem(IDC_PHOTOPROJECTS_LIST)) != NULL) { pList->SetRedraw(FALSE); pList->ResetContent(); int nPhotoPrjs = m_List.PhotoProjects(); for (int nPhotoPrj = 0; nPhotoPrj < nPhotoPrjs; nPhotoPrj++) { CPhotoPrjData* pPhotoPrj = (CPhotoPrjData*)m_List.PhotoProject(nPhotoPrj); ASSERT(pPhotoPrj != NULL); int nIndex = pList->AddString(pPhotoPrj->m_pSubAreaData[0]->GetName()); if (nIndex >= 0) { pList->SetItemData(nIndex, (DWORD)pPhotoPrj); if (pPhotoPrj->m_pSubAreaData[0]->GetName() == csOldName) { nNewSel = nIndex; } } } /* // Set the initial entry as necessary. */ if (pList->GetCount() > 0) { pList->SetCurSel(nNewSel); OnSelchangePhotoProjectsList(); } pList->SetRedraw(TRUE); } }
void CEnvelopeTypeDialog::BuildList(void) { CListBox* pList; if ((pList = (CListBox*)GetDlgItem(IDC_ENVELOPE_LIST)) != NULL) { /* // Get the name to match. */ CString csOldName; if (m_pOldInfo != NULL) { csOldName = m_pOldInfo->GetName(); } int nNewSel = 0; pList->SetRedraw(FALSE); pList->ResetContent(); int nLabels = m_List.Labels(); for (int nLabel = 0; nLabel < nLabels; nLabel++) { CLabelData* pLabel = m_List.Label(nLabel); ASSERT(pLabel != NULL); if (pLabel != NULL) { int nIndex = pList->AddString(pLabel->GetName()); if (nIndex >= 0) { pList->SetItemData(nIndex, (DWORD)pLabel); /* // If the label matches the name coming in, // remember its position. */ if (pLabel->GetName() == csOldName) { nNewSel = nIndex; } } } } // Always start with the first label. pList->SetCurSel(nNewSel); pList->SetRedraw(TRUE); OnSelchangeEnvelopeList(); // Do this by hand. } }