void CChangeOrderDlg::getSelected(CompactIntArray &selected) { CListBox *lb = getListBox(); int count = lb->GetSelCount(); int *items = new int[count]; lb->GetSelItems(count,items); selected.clear(); for(int i = 0; i < count; i++) { if(items[i] == lb->GetCount() - 1) { continue; // never select the last empty String } selected.add(items[i]); } delete[] items; }
void CGroupAddDialog::BuildAndRemoveSelected(CListBox& lb, std::vector<std::string>& str) { str.clear(); int selcnt = lb.GetSelCount(); if (selcnt) { int *sels = new int[selcnt]; lb.GetSelItems(selcnt, sels); for(int x=selcnt -1; x >= 0; --x) { str.push_back(lb.GetText(sels[x])); lb.DeleteString(sels[x]); } } }
LRESULT CPortalAdministrativePage::OnWizardNext() { CWizardData* pWizardData = ((CCHM2Dlg*)GetParent())->m_pWizardData; CWizardToolz toolz; CString strPortalURL, strMailServerName, strMailServerPort, strDefaultFromAddress; int nMailServerPort, nCount; // load data from controls //GetDlgItem(IDC_PORTAL_URL)->GetWindowText(strPortalURL); GetDlgItem(IDC_PORTAL_MAILSERVERNAME)->GetWindowText(strMailServerName); GetDlgItem(IDC_PORTAL_MAILSERVERPORT)->GetWindowText(strMailServerPort); GetDlgItem(IDC_PORTAL_DEFAULTFROMADDRESS)->GetWindowText(strDefaultFromAddress); CListBox* lstLanguages = (CListBox*)GetDlgItem(IDC_PORTAL_LANGUAGES); nCount = lstLanguages->GetSelCount(); pWizardData->m_arrLanguagesSel.RemoveAll(); pWizardData->m_arrLanguagesSel.SetSize(nCount); lstLanguages->GetSelItems(nCount, pWizardData->m_arrLanguagesSel.GetData()); // verify that all fields have been filled if (strMailServerName == "" || strMailServerPort == "" || strDefaultFromAddress == "") { AfxMessageBox(IDS_REQUIREDFIELDS); return -1; } // convert to numbers nMailServerPort = atoi(strMailServerPort); // verify ports values // check that the ports are free at the time of installation if (nMailServerPort < 1 || nMailServerPort > 65535) { AfxMessageBox(CRString(IDS_MAILSERVERPORT_INVALID)); return -1; } // store data in wizard data pWizardData->m_strPortalURL = strPortalURL; pWizardData->m_strMailServerName = strMailServerName; pWizardData->m_nMailServerPort = nMailServerPort; pWizardData->m_strDefaultFromAddress = strDefaultFromAddress; return 0; }
void CCreatePatchGroupDlg::OnBnClickedButtonDelgroup() { // TODO: Add your control notification handler code here CListBox* pList = (CListBox*)GetDlgItem(IDC_LIST_GROUPLIST); int nMaxItems = pList->GetSelCount(); LPINT rgIndex = new INT[nMaxItems]; memset(rgIndex, 0, sizeof(INT)*nMaxItems); pList->GetSelItems(nMaxItems, rgIndex); for (int i=0; i<nMaxItems; i++) { pList->DeleteString(rgIndex[i]-i); } delete []rgIndex; }