// 連携プログラム設定ボタン void CRsfSimpleForm::OnButtonPrg() { // TODO: この位置にコントロール通知ハンドラ用のコードを追加してください CString str; UpdateData(TRUE); // DDX更新 // 連携プログラムID CString strPrgId = m_aryPrgId.GetAt(m_idxPrg); /// プログラムCSVファイルの特定 CTPsetup tps(theApp.m_strDataFolder); tps.SetCallerId(m_strSenderId); CString strFile = tps.RsfPrgFileName(_T("$$$$"), strPrgId); /// 画面の表示 CComboBox *pcmb; pcmb = (CComboBox*)GetDlgItem(IDC_CMB_PRG); pcmb->GetLBText(m_idxPrg, str); CRsfPrgDialog dlg(this, str); dlg.SetFile(strFile); if (dlg.DoModal() == IDOK) { /// RSFファイルの更新 if (!UpdateFile()) return; /// 画面の更新 UpdateForm(); } }
void CDGProp::OnCloseupDgname() { UpdateData(TRUE); CComboBox* box = (CComboBox*)GetDlgItem(IDC_DGNAME); int i = box->GetCurSel(); box->GetLBText(i, m_dgName); }
LRESULT FindView::onDimensionSelection(WORD/*wNotifyCode*/, WORD/*wID*/, HWND/*hWndCtl*/, BOOL&/*bHandled*/) { CComboBox cb = GetDlgItem(IDC_DIMENSION_COMBO); unsigned int dimension_id = 0; int item = -1; if ((item = cb.GetCurSel()) != CB_ERR) { dimension_id = (unsigned int)cb.GetItemData(item); TCHAR buffer[256]; cb.GetLBText(item, buffer); m_settings->setValue(_T("DefaultDimension"), buffer); } updateCharList(dimension_id); CComboBox toon_combo = GetDlgItem(IDC_CHARCOMBO); if (toon_combo.GetCount() > 0) { toon_combo.SetCurSel(0); } if (dimension_id != m_lastQueryDimension) { UpdateFindQuery(); } return 0; }
void CConfigAppearance::OnCbnSelchangeFont() { CComboBox *pFontList = static_cast<CComboBox*>(GetDlgItem(IDC_FONT)); pFontList->GetLBText(pFontList->GetCurSel(), m_strFont.data()); RedrawWindow(); SetModified(); }
void CCgxDlg::OnCbnSelchangeScriptList() { TCHAR fileName[MAX_PATH] = {0}; TCHAR path[MAX_PATH] = {0}; CComboBox* scriptList = (CComboBox *)GetDlgItem(IDC_SCRIPT_LIST); CEdit* script = (CEdit *)GetDlgItem(IDC_SCRIPT); int idx = scriptList->GetCurSel(); scriptList->GetLBText(idx, fileName); swprintf(path, sizeof(TCHAR)*MAX_PATH, TEXT("script\\%s"), fileName); CFile file; file.Open(path, CFile::modeRead); if(file.GetLength() < 1) { return; } ULONGLONG fileSize = file.GetLength(); char* buff = new char[fileSize]; file.Read(buff, fileSize); int size = MultiByteToWideChar(CP_ACP, NULL, buff, fileSize, NULL, 0); TCHAR* text = new TCHAR[size+1]; MultiByteToWideChar(CP_ACP, NULL, buff, fileSize, text, size); text[size] = '\0'; script->SetWindowTextW(text); //TRACE(text); delete[] buff; delete[] text; file.Close(); }
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; }
void CDisplayResolutionPane::OnSelchangeCombo1() { char str[32]; CComboBox* pCB = (CComboBox*) GetDlgItem(IDC_COMBO1); pCB->GetLBText(pCB->GetCurSel(), str); VisualGraphics* theVisualGraphics = VisualGraphics::getInstance(); UInt16 horizontalPixels; UInt16 verticalPixels; UInt16 bitsPerPixel; UInt16 refreshRate; theVisualGraphics->matchDisplayResolutionShowStrWithPrefs(str, horizontalPixels, verticalPixels, bitsPerPixel, refreshRate); VisualDataStore::setPreferenceValueInt(VisualConfiguration::kFullscreenWidth, horizontalPixels); VisualDataStore::setPreferenceValueInt(VisualConfiguration::kFullscreenHeight, verticalPixels); VisualDataStore::setPreferenceValueInt(VisualConfiguration::kFullscreenBitsPerPixel, bitsPerPixel); VisualDataStore::setPreferenceValueInt(VisualConfiguration::kFullscreenRefreshRate, refreshRate); VisualDataStore::storePreferences(); UInt16 minBitsPerPixel = 24; UInt16 maxBitsPerPixel = 32; VisualDataStore::setPreferredDisplayResolution(minBitsPerPixel, maxBitsPerPixel, bitsPerPixel, horizontalPixels, verticalPixels); }
void CUrlBar::OnSelchangeUrl() { // TODO: Add your control notification handler code here #if 0 CString strText; CString strItem; CComboBox* pCBox = (CComboBox*)GetDlgItem(IDC_URL); int nIndex = pCBox->GetCurSel(); if (nIndex == CB_ERR) return; pCBox->GetLBText(nIndex, strItem); //AfxFormatString1(strText, IDS_SELECTED_PROMPT, (LPCTSTR)strItem); TRACE("On Sel Change URL %s \n",(const char *) strItem); #endif CString url; int nIndex = m_url.GetCurSel(); if (nIndex == CB_ERR) return; m_url.m_curSel = nIndex; m_url.GetText(nIndex,url); CMyglView* pView = ((CMyglApp *) AfxGetApp())->GetActiveView(); if (pView) { pView->ReadUrl( url); } // SetMessageText(strItem); }
bool CPPageBase::FillComboToolTip(CComboBox& comboBox, TOOLTIPTEXT* pTTT) { bool bNeedTooltip = false; CDC* pDC = comboBox.GetDC(); CFont* pFont = comboBox.GetFont(); CFont* pOldFont = pDC->SelectObject(pFont); TEXTMETRIC tm; pDC->GetTextMetrics(&tm); CRect comboBoxRect; comboBox.GetWindowRect(comboBoxRect); comboBoxRect.right -= GetSystemMetrics(SM_CXVSCROLL) + 2 * GetSystemMetrics(SM_CXEDGE); int i = comboBox.GetCurSel(); CString str; comboBox.GetLBText(i, str); CSize textSize; textSize = pDC->GetTextExtent(str); pDC->SelectObject(pOldFont); comboBox.ReleaseDC(pDC); textSize.cx += tm.tmAveCharWidth; if (textSize.cx > comboBoxRect.Width()) { bNeedTooltip = true; if (str.GetLength() > _countof(pTTT->szText) - 1) { str.Truncate(_countof(pTTT->szText) - 1); } _tcscpy_s(pTTT->szText, str); pTTT->hinst = nullptr; } return bNeedTooltip; }
//确定交易场次 void CHorseRaceMainDlg::OnBnClickedButton3() { // TODO: 在此添加控件通知处理程序代码 CComboBox* pcombox = (CComboBox*)(GetDlgItem(IDC_COMBO2)); pcombox->GetLBText(pcombox->GetCurSel(),m_TradeRace); TRACE(m_TradeRace); return ; }
//确认显示记录场次 void CHorseRaceMainDlg::OnBnClickedButton6() { // TODO: 在此添加控件通知处理程序代码 CComboBox* pcombox = (CComboBox*)(GetDlgItem(IDC_COMBO1)); pcombox->GetLBText(pcombox->GetCurSel(),m_RcordRace); m_TradeRecord.DeleteAllItems(); m_bTradeRecord = FALSE; TRACE(m_TradeRace); }
void OnxxxSelChange(UINT /*uNotifyCode*/, int /*nID*/, CWindow /*wndCtl*/) { CString strText; m_wndCboxxx.GetLBText(m_wndCboxxx.GetCurSel(), strText); SetItemText(101, strText); return; }
void CADHistFrm::OnSelchangeCOMBORate() { // TODO: Add your control notification handler code here CADHistDoc* pDoc = (CADHistDoc*)GetActiveDocument(); // 在Frame中取得当前文档指针 CComboBox* pRate = (CComboBox*)(m_wndSetupBar.GetDlgItem(IDC_COMBO_Rate)); CString strRate; int Index = pRate->GetCurSel(); // 取得当前选择索引号 pRate->GetLBText(Index, strRate); // 根据选择,取得所选择项文本 pDoc->m_Rate = wcstol(strRate, NULL, 10); // 将字符转换成数字 }
void CDlgForEach::RenameParam( LPCTSTR strOld, LPCTSTR strNew ) { BOOL bSelectParam = FALSE; CComboBox* pBox; CString str; int n; pBox = (CComboBox*)GetDlgItem(IDC_COMBO_PARAM); n = pBox->GetCurSel(); if(n != -1) { pBox->GetLBText(n, str); if(str == strOld) bSelectParam = TRUE; } DeleteStringFromComboBox(pBox, strOld); AddStringToComboBox(pBox, strNew); if(bSelectParam) SelectStringFromComboBox(pBox, strNew); for(int i = 0; i < (int)m_vpComboBox.size(); i++) { BOOL bSelect = FALSE; pBox = m_vpComboBox[i]; n = pBox->GetCurSel(); if(n != -1) { pBox->GetLBText(n, str); if(str == strOld) bSelect = TRUE; } DeleteStringFromComboBox(pBox, strOld); AddStringToComboBox(pBox, strNew); if(bSelect) SelectStringFromComboBox(pBox, strNew); } }
CString CFcFontBar::GetSelectedFontName() const { CComboBox* pCb = (CComboBox*)GetDlgItem(ID_FORMAT_FONTNAME); ASSERT_VALID(pCb); CString fontName; int selIndex = pCb->GetCurSel(); if (selIndex != CB_ERR) pCb->GetLBText(selIndex, fontName); return fontName; }
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; } } }
CString CFcFontBar::GetSelectedHtmlTag() const { CComboBox* pCb = (CComboBox*)GetDlgItem(ID_FORMAT_BLOCKFORMAT); ASSERT_VALID(pCb); CString HtmlTag; int selIndex = pCb->GetCurSel(); if (selIndex != CB_ERR) pCb->GetLBText(selIndex, HtmlTag); return HtmlTag; }
void CEndDialog::OnOK() { // TODO: Add your specialized code here and/or call the base class CComboBox * chComboBox = (CComboBox *)GetDlgItem(IDC_CMB_END_POINT); CComboBox * parComboBox = (CComboBox *)GetParent()->GetDlgItem(IDC_CMB_END_POINT); int nIndx = chComboBox->GetCurSel(); CString tmp; chComboBox->GetLBText(nIndx, tmp); parComboBox->SelectString(nIndx, tmp); CDialog::OnOK(); }
CString CComboBox_GetSelectedString(const CComboBox &ctrlComboBox) { ASSERT(ctrlComboBox.GetSafeHwnd() != NULL); int nCurSel = ctrlComboBox.GetCurSel(); CString strSelectedItem; if (nCurSel != CB_ERR) ctrlComboBox.GetLBText(nCurSel, strSelectedItem); return strSelectedItem; }
//widget event handlers void TextStyleDialog::OnCbnSelchangeFont() { CWnd* cwnd = this->GetFocus(); CComboBox* p = (CComboBox*)GetDlgItem(IDC_FONT); int sel = p->GetCurSel(); TRACE("SEL: %d", sel); CString tmp; p->GetWindowText(tmp); p->GetLBText(sel, tmp); TRACE(tmp); triggerVirtualKeyStroke(p); }
void CMainFrame::OnSelChangePalette() { CString strText; CString strItem; CComboBox* pCBox = (CComboBox*)m_wndDlgBar.GetDlgItem(IDC_PALETTE); int nIndex = pCBox->GetCurSel(); if (nIndex == CB_ERR) return; pCBox->GetLBText(nIndex, strItem); AfxFormatString1(strText, IDS_SELECTED_PROMPT, (LPCTSTR)strItem); SetMessageText(strText); }
void CMainFrame::OnSelChange() { CString FileName; CMFCToolBarComboBoxButton* pComboButton = (CMFCToolBarComboBoxButton*) m_wndLoadFileBar.GetButton(1); CComboBox* pLoadFile = pComboButton->GetComboBox(); if(CB_ERR!=pLoadFile->GetCurSel()) { pLoadFile->GetLBText(pLoadFile->GetCurSel(),FileName); AfxGetApp()->OpenDocumentFile(FileName); } }
// ************************************************************************** // DoDataExchange () // // Description: // This method is called by the framework to exchange and validate dialog data. // // Parameters: // CDataExchange *pDX A pointer to a CDataExchange object. // // Returns: // void // ************************************************************************** void CKItemPropertiesDlg::DoDataExchange (CDataExchange *pDX) { // Perform default processing: CDialog::DoDataExchange (pDX); // Exchange data between controls and associated member variables: //{{AFX_DATA_MAP(CKItemPropertiesDlg) DDX_Text (pDX, IDC_ACCESSPATH, m_strAccessPath); DDX_Check (pDX, IDC_ACTIVE, m_bActive); DDX_Text (pDX, IDC_ITEMID, m_strItemID); //}}AFX_DATA_MAP // Get pointer to data type combo box: CComboBox *pCombo = (CComboBox *)GetDlgItem (IDC_DATATYPE); CString strType; // If not save and validate, use member vaiable value to make // data type combo box selection: if (!pDX->m_bSaveAndValidate) { CString strType; switch (m_vtDataType & ~VT_ARRAY) { case VT_BOOL: strType = _T("Boolean"); break; case VT_UI1: strType = _T("Byte"); break; case VT_I1: strType = _T("Char"); break; case VT_UI2: strType = _T("Word"); break; case VT_I2: strType = _T("Short"); break; case VT_UI4: strType = _T("DWord"); break; case VT_I4: strType = _T("Long"); break; case VT_R4: strType = _T("Float"); break; case VT_R8: strType = _T("Double"); break; case VT_BSTR: strType = _T("String"); break; default: strType = _T("Native"); break; } // Update array flag data: if ((m_vtDataType & VT_ARRAY) != 0) strType += _T(" Array"); // Select data type: pCombo->SelectString (-1, strType); } // else transfer data type combo box index to vartype member variable: else { pCombo->GetLBText (pCombo->GetCurSel (), strType); m_vtDataType = VartypeFromString (strType); } }
void CConfigAppearance::OnCbnSelchangeFontSize() { CStringW str; CComboBox *pFontSizeList = static_cast<CComboBox*>(GetDlgItem(IDC_FONT_SIZE)); pFontSizeList->GetLBText(pFontSizeList->GetCurSel(), str); if (auto newSize = conv::to_int(str)) { if (*newSize < 5 || *newSize > 30) return; // arbitrary m_iFontSize = *newSize; RedrawWindow(); SetModified(); } }
void CInstrumentEditorN163Wave::OnWavePosSelChange() { CString str; CComboBox *pPosBox = (CComboBox*)GetDlgItem(IDC_WAVE_POS); pPosBox->GetLBText(pPosBox->GetCurSel(), str); int pos = _ttoi(str); if (pos > 255) pos = 255; if (pos < 0) pos = 0; m_pInstrument->SetWavePos(pos); }
void CMainFrmDlgBar::OnSelchangeComboStyle () { CComboBox* pCombo = (CComboBox*) GetDlgItem (IDC_COMBO_MFR_STYLE); CString s; pCombo->GetLBText (pCombo->GetCurSel (), s); CMDIChildWnd* pChild = ((CMDIFrameWnd*) AfxGetMainWnd ())->MDIGetActive (); if (pChild != NULL) { CCdCoverCreator2Doc* pDoc = (CCdCoverCreator2Doc*) pChild->GetActiveDocument (); if (pDoc != NULL) pDoc->SetStyle (s); } }
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; } }
void CProjEdit::OnSelchangeType() { CString tmpstr; int idx; CComboBox *ce; ce=(CComboBox *) GetDlgItem(IDC_TYPE); idx=ce->GetCurSel(); if(idx>=0) { ce->GetLBText(idx,tmpstr); the_projectile.header.type=(short) strtonum(tmpstr); UpdateData(UD_DISPLAY); } }
void CSetChip::OnBnClickedOk() { //获取变量 UpdateData(TRUE) ; //得到押注 CComboBox *pChipComBox = ( CComboBox* ) GetDlgItem( IDC_SETCHIP ) ; CString strChip ; int nCurSel = pChipComBox->GetCurSel() ; pChipComBox->GetLBText( nCurSel, strChip ) ; m_nChip = atoi( strChip ) ; OnOK(); }
void CMainFrame::OnSelChangeUrl() { CString strText; CString strItem; CComboBox* pCBox = (CComboBox*)m_wndUrlBar.GetDlgItem(IDW_URL); int nIndex = pCBox->GetCurSel(); if (nIndex == CB_ERR) return; pCBox->GetLBText(nIndex, strItem); //AfxFormatString1(strText, IDS_SELECTED_PROMPT, (LPCTSTR)strItem); // TRACE("On Sel Change URL %s \n",(const char *) strItem); SetMessageText(strItem); }