void CEasyClientDlg::OnCbnSelchangeComboSource() { CComboBox* pComboxMediaSource = (CComboBox*)GetDlgItem(IDC_COMBO_SOURCE); CComboBox* pVideoCombo = (CComboBox*)GetDlgItem(IDC_COMBO_CAMERA) ; CComboBox* pComboxAudioSource = (CComboBox*)GetDlgItem(IDC_COMBO_MIC) ; CEdit* pEdtRtspSource = (CEdit*)GetDlgItem(IDC_EDIT_SREAM_URL); if (NULL == pComboxMediaSource) return; int iCount = pComboxMediaSource->GetCount(); int iSel = pComboxMediaSource->GetCurSel(); if (iSel == 0) { pVideoCombo->EnableWindow(TRUE); pComboxAudioSource->EnableWindow(TRUE); pEdtRtspSource->SetReadOnly(TRUE); } else { pVideoCombo->EnableWindow(FALSE); pComboxAudioSource->EnableWindow(FALSE); pEdtRtspSource->SetReadOnly(FALSE); } // if (NULL != pComboxAudioSource) pComboxAudioSource->ShowWindow(iSel == iCount-1?SW_HIDE:SW_SHOW); // if (NULL != pEdtRtspSource) pEdtRtspSource->ShowWindow(iSel == iCount-1?SW_SHOW:SW_HIDE); // }
void CConfigCrossLineRule::ShowRuleInfo() { m_strRuleName = m_stuInfo.szRuleName; m_bEnable = m_stuInfo.bRuleEnable; { CComboBox* pBox = (CComboBox*)GetDlgItem(IDC_COMBO_DIRECT); if (pBox) { int n = pBox->GetCount(); if (m_stuInfo.nDirection < n) { pBox->SetCurSel(m_stuInfo.nDirection); } } } { CComboBox* pBox = (CComboBox*)GetDlgItem(IDC_COMBO_TriggerPosition); if (pBox) { int n = pBox->GetCount(); if (m_stuInfo.nDirection < n) { pBox->SetCurSel(m_stuInfo.nTriggerPosition); } } } m_clObjType.DeleteAllItems(); if (m_clObjType.GetHeaderCtrl()) { int nColumCount = m_clObjType.GetHeaderCtrl()->GetItemCount(); for (int i = 0; i < nColumCount; i++) { m_clObjType.DeleteColumn(0); } } m_clObjType.SetExtendedStyle(m_clObjType.GetExtendedStyle() | LVS_EX_HEADERDRAGDROP | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES|LVS_EX_CHECKBOXES); m_clObjType.InsertColumn(0, ConvertString("ObjectType"), LVCFMT_LEFT, 80, -1); for(int i = 0; i < m_pParentWnd->m_nSupportedObjTypeNum; i++) { m_clObjType.InsertItem(LVIF_TEXT|LVIF_STATE,i,ConvertString(m_pParentWnd->m_gObjectTypeName[i]),0,LVIS_SELECTED,0,0); for(int k = 0; k < m_stuInfo.nObjectTypeNum; k++) { if(strcmp(m_stuInfo.szObjectTypes[k], m_pParentWnd->m_gObjectTypeName[i]) == 0) { m_clObjType.SetCheck(i, TRUE); break; } } } return; }
void CDlgAdminCharSkillHEAL::Set(CInfoSkillBase *pSrc) { int i, nNo, nCount; DWORD dwTmp; CComboBox *pCombo; PCInfoSkillHEAL pSrcTmp = (PCInfoSkillHEAL)pSrc; m_dwValue1 = pSrcTmp->m_dwValue1; /* 効果1 */ m_dwValue2 = pSrcTmp->m_dwValue2; /* 効果2 */ m_dwDistance = pSrcTmp->m_dwDistance; /* 射程距離 */ /* ヒット時の表示エフェクト */ pCombo = &m_ctlHitEffect; nNo = 0; nCount = pCombo->GetCount (); for (i = 0; i < nCount; i ++) { dwTmp = pCombo->GetItemData (i); if (pSrcTmp->m_dwHitEffectID == dwTmp) { nNo = i; break; } } pCombo->SetCurSel (nNo); /* 回復種別 */ pCombo = &m_ctlHealType; nNo = 0; nCount = pCombo->GetCount (); for (i = 0; i < nCount; i ++) { dwTmp = pCombo->GetItemData (i); if (pSrcTmp->m_dwHealType == dwTmp) { nNo = i; break; } } pCombo->SetCurSel (nNo); /* 範囲 */ pCombo = &m_ctlArea; nNo = 0; nCount = pCombo->GetCount (); for (i = 0; i < nCount; i ++) { dwTmp = pCombo->GetItemData (i); if (pSrcTmp->m_dwArea == dwTmp) { nNo = i; break; } } pCombo->SetCurSel (nNo); UpdateData (FALSE); }
void NewGUI_ComboBox_UpdateHistory(CComboBox& comboBox, const std::basic_string<TCHAR>& strNew, std::vector<std::basic_string<TCHAR> >* pvHistoryItems, size_t dwMaxHistoryItems) { ASSERT(pvHistoryItems != NULL); if(pvHistoryItems == NULL) return; if(strNew.size() > 0) { std::vector<std::basic_string<TCHAR> >::iterator itExists = std::find(pvHistoryItems->begin(), pvHistoryItems->end(), strNew); if(itExists != pvHistoryItems->end()) pvHistoryItems->erase(itExists); size_t dwCurSize = pvHistoryItems->size(); ASSERT(dwCurSize <= dwMaxHistoryItems); while(dwCurSize >= dwMaxHistoryItems) { pvHistoryItems->erase(pvHistoryItems->begin()); if(dwCurSize == pvHistoryItems->size()) { ASSERT(FALSE); break; } dwCurSize = pvHistoryItems->size(); } pvHistoryItems->push_back(strNew); } ASSERT(pvHistoryItems->size() <= dwMaxHistoryItems); const int nOrgCount = comboBox.GetCount(); for(int n = 0; n < nOrgCount; ++n) { const UINT uIndex = static_cast<UINT>(nOrgCount - n - 1); VERIFY(comboBox.DeleteString(uIndex) != CB_ERR); } for(size_t i = 0; i < pvHistoryItems->size(); ++i) { const size_t iIndex = pvHistoryItems->size() - i - 1; comboBox.AddString(pvHistoryItems->at(iIndex).c_str()); } if(comboBox.GetCount() > 0) { comboBox.AddString(HCMBX_SEPARATOR); comboBox.AddString(HCMBX_CLEARLIST); } }
void CComboBox_CopyTo(const CComboBox &ctrlComboBox, CStringArray &arrstrItems) { ASSERT(ctrlComboBox.GetSafeHwnd() != NULL); arrstrItems.RemoveAll(); arrstrItems.SetSize(ctrlComboBox.GetCount()); CString strItem; for (int i = 0; i < ctrlComboBox.GetCount(); ++i) { ctrlComboBox.GetLBText(i, strItem); arrstrItems[i] = strItem; } }
// Goober5000 void wing_editor::OnRestrictArrival() { int arrive_from_ship; CComboBox *box; restrict_paths dlg; // grab stuff from GUI UpdateData(TRUE); if (m_arrival_location != ARRIVE_FROM_DOCK_BAY) { Int3(); return; } box = (CComboBox *) GetDlgItem(IDC_ARRIVAL_TARGET); if (box->GetCount() == 0) return; arrive_from_ship = box->GetItemData(m_arrival_target); if (!ship_has_dock_bay(arrive_from_ship)) { Int3(); return; } dlg.m_arrival = true; dlg.m_ship_class = Ships[arrive_from_ship].ship_info_index; dlg.m_path_mask = &Wings[cur_wing].arrival_path_mask; dlg.DoModal(); }
static void LoadDefaultCodec(CAtlArray<Codec>& codecs, CComboBox& box, const GUID& cat) { int len = box.GetCount(); if (len >= 0) { box.SetCurSel(0); } if (cat == GUID_NULL) { return; } CString DisplayName = AfxGetApp()->GetProfileString(IDS_RS_CAPTURE _T("\\") + CStringFromGUID(cat), _T("DisplayName")); for (int i = 0; i < len; i++) { int iSel = box.GetItemData(i); if (iSel < 0) { continue; } Codec& c = codecs[iSel]; if (DisplayName == c.DisplayName) { box.SetCurSel(i); if (!c.pBF) { c.pMoniker->BindToObject(NULL, NULL, __uuidof(IBaseFilter), (void**)&c.pBF); } break; } } }
LRESULT FindView::OnInitDialog(UINT/*uMsg*/, WPARAM/*wParam*/, LPARAM/*lParam*/, BOOL&/*bHandled*/) { this->SetWindowText(_T("Find View")); updateDimensionList(); CComboBox cb = GetDlgItem(IDC_DIMENSION_COMBO); if (cb.GetCount() > 0) { int index = CB_ERR; if (!m_settings->getValue(_T("DefaultDimension")).empty()) { index = cb.FindStringExact(-1, m_settings->getValue(_T("DefaultDimension")).c_str()); } if (index == CB_ERR) { index = 0; } cb.SetCurSel(index); updateCharList(cb.GetItemData(index)); m_lastQueryDimension = cb.GetItemData(index); CComboBox toon_combo = GetDlgItem(IDC_CHARCOMBO); if (toon_combo.GetCount() > 0) { toon_combo.SetCurSel(0); } } DlgResize_Init(false, true, WS_CLIPCHILDREN); return 0; }
int FindReplDlg::GetFindText(CComboBox& wnd, bsString& text) { int len; char *tp; int sel = wnd.GetCurSel(); if (sel == -1) { len = wnd.GetWindowTextLength()+1; tp = new char[len]; wnd.GetWindowText(tp, len); sel = wnd.FindStringExact(-1, tp); if (sel == -1) { sel = wnd.InsertString(0, tp); wnd.SetCurSel(sel); } int cnt; while ((cnt = wnd.GetCount()) >= 20) wnd.DeleteString(cnt-1); } else { len = wnd.GetLBTextLen(sel)+1; tp = new char[len]; wnd.GetLBText(sel, tp); } text.Attach(tp); return sel; }
// Goober5000 void wing_editor::OnRestrictDeparture() { int depart_to_ship; CComboBox *box; restrict_paths dlg; // grab stuff from GUI UpdateData(TRUE); if (m_departure_location != DEPART_AT_DOCK_BAY) { Int3(); return; } box = (CComboBox *) GetDlgItem(IDC_DEPARTURE_TARGET); if (box->GetCount() == 0) return; depart_to_ship = box->GetItemData(m_departure_target); if (!ship_has_dock_bay(depart_to_ship)) { Int3(); return; } dlg.m_arrival = false; dlg.m_ship_class = Ships[depart_to_ship].ship_info_index; dlg.m_path_mask = &Wings[cur_wing].departure_path_mask; dlg.DoModal(); }
//=========================================================================== void CFAVConnectDlg::OnBnClickedConnectCheck() //=========================================================================== { // TODO: Add your control notification handler code here CArray<CString,CString> strArrayCOM; UINT uPortCount; CComboBox* pCbox = (CComboBox*)GetDlgItem(IDC_CONNECT_COMSEL); CString strCOMPORT; if(m_bCOMSel){ GetDlgItem(IDC_CONNECT_COMSEL)->EnableWindow(FALSE); m_bGetSerialPort = FALSE; for(UINT i = pCbox->GetCount(); i > 0; i--){ pCbox->DeleteString(i-1); } m_bCOMSel = FALSE; } else{ if(!m_bGetSerialPort){ m_bGetSerialPort = TRUE; uPortCount = m_UARTComm.GetSerialPort(TRUE, strArrayCOM); for(UINT i = 0; i < uPortCount; i++){ strCOMPORT = strArrayCOM.GetAt(m_UARTComm.GetCOMIndex(i)); pCbox->InsertString(i,strCOMPORT); } pCbox->SetCurSel(0); } GetDlgItem(IDC_CONNECT_COMSEL)->EnableWindow(TRUE); m_bCOMSel = TRUE; } }
void CComboBox_Clear(CComboBox &ctrlComboBox) { ASSERT(ctrlComboBox.GetSafeHwnd() != NULL); if (ctrlComboBox.GetSafeHwnd() == NULL) return; for (int i = ctrlComboBox.GetCount() - 1; i >= 0; i--) ctrlComboBox.DeleteString(i); }
//------------------------------------------------------------------------------ // //------------------------------------------------------------------------------ int FindComboItemByData ( CComboBox & ComboBox, DWORD Value ) { for ( int i = 0; i < ComboBox.GetCount (); ++i ) { if (ComboBox.GetItemData (i) == Value) return i; } return CB_ERR; }
void CEditListEditor::SelectCombo(LPCTSTR strValue, CComboBox& combo) { for (int i = 0; i < combo.GetCount(); i++) { CString strTemp; combo.GetLBText(i, strTemp); if (strTemp == strValue) { combo.SetCurSel(i); break; } } }
void ClearComboBox(CComboBox &stComboBox) { stComboBox.Clear(); { int n = stComboBox.GetCount(); for (int i=0; i<n; i++) { stComboBox.DeleteString(0); } } }
static void SelectLanguage(CComboBox &combobox, LONG langueage) { for (int i = 0; i < combobox.GetCount(); ++i) { if (combobox.GetItemData(i) == langueage) { combobox.SetCurSel(i); break; } } }
void CAntiVirus::Free(CComboBox& wndAntiVirus) { if ( ! ::IsWindow( wndAntiVirus.GetSafeHwnd() ) ) return; const int nCount = wndAntiVirus.GetCount(); for ( int i = 0; i < nCount; ++i ) { delete (CString*)wndAntiVirus.GetItemDataPtr( i ); } }
void SetCurSelItemData(CComboBox& wnd, DWORD_PTR nItemData) { int nItems = wnd.GetCount(); for(int i=0;i<nItems;i++) { if(wnd.GetItemData(i) == nItemData) { wnd.SetCurSel(i); return; } } }
void AutoSetComboBoxHeight(CComboBox& c) { int itemCount = c.GetCount() + 1; int itemHeight = c.GetItemHeight(0); int editAreaHeight = c.GetItemHeight(0); int targetHeight = editAreaHeight + (itemHeight * itemCount); RECT rc; c.GetWindowRect(&rc); c.GetParent().ScreenToClient(&rc); rc.bottom = rc.top + targetHeight; c.MoveWindow(&rc, FALSE); }
inline long finditemdata( CComboBox& cb, DWORD dwItemdata ) { long n = cb.GetCount(); long i; for( i = 0; i < n; i++ ) { if( cb.GetItemData( i ) == dwItemdata ) return i; } return LB_ERR; }
void CCubeTool::InitCBCubeNo () { if (!GetMine ()) return; CComboBox *pcb = CBCubeNo (); if (m_mine->SegCount () != pcb->GetCount ()) { pcb->ResetContent (); int i; for (i = 0; i < m_mine->SegCount (); i++) pcb->AddString (itoa (i, message, 10)); } pcb->SetCurSel (m_nCube); }
BOOL CFcFontBar::AddHtmlTag(const CString& tag, BOOL bClear) { CComboBox* pCb = (CComboBox*)GetDlgItem(ID_FORMAT_BLOCKFORMAT); ASSERT_VALID(pCb); if (bClear) { for (int ii = pCb->GetCount()-1; ii >= 0; ii--) pCb->DeleteString(ii); } pCb->AddString(tag); return TRUE; }
void CImageProcessDlg::UpdateControls() { BOOL bMonochrome = m_pDevice->IsMonochromeDevice(); UCHAR RGain = 0, GGain = 0, BGain = 0; if(!bMonochrome) m_pDevice->GetGain(&RGain, &GGain, &BGain); SetGainCtrl(RGain, GGain, BGain); FLOAT fGamma; m_pDevice->GetGamma(&fGamma); SetGammaCtrl(fGamma); SHORT shContrast = 0; if(!bMonochrome) m_pDevice->GetContrast(&shContrast); SetContrastCtrl(shContrast); BOOL bEnable = FALSE; BYTE Saturation = 0; if(!bMonochrome) m_pDevice->GetSaturation(&Saturation); if(!bMonochrome) m_pDevice->GetSaturationState(&bEnable); CheckDlgButton(IDC_CHK_SATURATION, bEnable); m_ctrlSaturation.EnableWindow(bEnable); SetSaturationCtrl(Saturation); m_pDevice->GetMirror(MD_HORIZONTAL, &bEnable); CheckDlgButton(IDC_HFLIP, bEnable); m_pDevice->GetMirror(MD_VERTICAL, &bEnable); CheckDlgButton(IDC_VFLIP, bEnable); if(!bMonochrome) m_pDevice->GetMonochrome(&bEnable); else bEnable = FALSE; CheckDlgButton(IDC_MONO, bEnable); m_pDevice->GetInverse(&bEnable); CheckDlgButton(IDC_INVERSE, bEnable); emDeviceFrameSpeed devSpeed = HIGH_SPEED; m_pDevice->GetFrameSpeed(&devSpeed); CComboBox *pComboSpeed = (CComboBox *)GetDlgItem(IDC_CMB_FRAMESPEED); if(pComboSpeed != NULL) { int nCount = pComboSpeed->GetCount(); for(int i = 0; i < nCount; ++i) { if(pComboSpeed->GetItemData(i) == devSpeed) { pComboSpeed->SetCurSel(i); break; } } } float fSpeedTune; m_pDevice->GetFrameSpeedTune(&fSpeedTune); SetSpeedTuneCtrl(fSpeedTune); }
void CDlgRename::OnDestroy() { CDialog::OnDestroy(); // Destruction des formats CComboBox* pCBox = (CComboBox *) GetDlgItem( IDC_CMB_FORMATS ); for( int i = 0 ; i < pCBox->GetCount() ; i++ ) { CFormat* pFormat = (CFormat *) pCBox->GetItemData( i ); delete pFormat; } }
void CConfigDlg::OnBnClickedButton1() { CComboBox *playlists = (CComboBox*)GetDlgItem( IDC_PLAYLISTS ); int selected = playlists->GetCurSel(); playlists->ResetContent(); m_playlists.clear(); m_plids.clear(); GetPlaylists(); FillBoxes(); if( selected < playlists->GetCount() ) playlists->SetCurSel( selected ); else SelectPlaylist(); }
void CAntiVirus::Enum(CComboBox& wndAntiVirus) { if ( ! ::IsWindow( wndAntiVirus.GetSafeHwnd() ) ) return; wndAntiVirus.ResetContent(); // No anti-virus int nAntiVirus = wndAntiVirus.AddString( _T("") ); wndAntiVirus.SetItemDataPtr( nAntiVirus, (LPVOID)new CString() ); // Enum available anti-viruses CComPtr< ICatInformation > pInfo; HRESULT hr = pInfo.CoCreateInstance( CLSID_StdComponentCategoriesMgr ); if ( SUCCEEDED( hr ) ) { const CATID IDs[ 1 ] = { CATID_MSOfficeAntiVirus }; CComPtr< IEnumCLSID > pEnum; hr = pInfo->EnumClassesOfCategories( 1, IDs, 0, NULL, &pEnum ); if ( SUCCEEDED( hr ) ) { CLSID clsid; while ( pEnum->Next( 1, &clsid, NULL ) == S_OK ) { const CString sCLSID = Hashes::toGuid( clsid, true ); HKEY hClass = NULL; if ( ERROR_SUCCESS == RegOpenKeyEx( HKEY_CLASSES_ROOT, _T("CLSID\\") + sCLSID, 0, KEY_READ, &hClass ) ) { // Get it name TCHAR szValue[ MAX_PATH ] = {}; DWORD nValue = MAX_PATH, nType = REG_SZ; if ( ERROR_SUCCESS == RegQueryValueEx( hClass, NULL, NULL, &nType, (LPBYTE)szValue, &nValue ) ) { const int nIndex = wndAntiVirus.AddString( szValue ); wndAntiVirus.SetItemDataPtr( nIndex, (LPVOID)new CString( sCLSID ) ); if ( Settings.General.AntiVirus.CompareNoCase( sCLSID ) == 0 ) { nAntiVirus = nIndex; } } RegCloseKey( hClass ); } } } } wndAntiVirus.SetCurSel( nAntiVirus ); wndAntiVirus.EnableWindow( wndAntiVirus.GetCount() > 1 ); }
BOOL CTabCharacteristicsDlg::SetValue(int nValue, CComboBox &cb) { int nCount = cb.GetCount(); for (int i=0;i<nCount;i++) if ((int)cb.GetItemData(i) == nValue) { cb.SetCurSel(i); cb.EnableWindow(TRUE); return(TRUE); } cb.SetCurSel(-1); cb.EnableWindow(FALSE); return(FALSE); }
//================================================= // Message Handlers //================================================= void CMainDlg::OnDestroy() { CDialog::OnDestroy(); GetControlValues(); // Clean up CLSIDs in combobox CComboBox* pCombo = NULL; VERIFY(pCombo = (CComboBox*)GetDlgItem(IDC_IMAGE_EXT)); while(pCombo->GetCount() > 0) { CLSID* pCLSID = (CLSID*)pCombo->GetItemData(0); delete pCLSID; pCombo->DeleteString(0); } }
BOOL CEnterOptionsNameDlg::OnInitDialog() { __super::OnInitDialog(); CComboBox *cb = getNameCombo(); const StringArray names = Options::getExistingNames(); for(size_t i = 0; i < names.size(); i++) { cb->AddString(names[i].cstr()); } cb->SetFocus(); if((cb->GetCount() == 0) || (m_name.GetLength() == 0)) { cb->SetCurSel(0); } else { cb->SetCurSel((int)names.getFirstIndex((LPCTSTR)m_name)); } return false; }
BOOL CStockPropPage::OnEditProperty(DISPID dispid, CComboBox& combo) { int cItems = combo.GetCount(); int i; for (i = 0; i < cItems; i++) { if ((DISPID)(combo.GetItemData(i)) == dispid) { combo.SetCurSel(i); OnSelchangePropname(combo); return TRUE; } } return FALSE; }