本文整理汇总了C++中CComboBox::SelectString方法的典型用法代码示例。如果您正苦于以下问题:C++ CComboBox::SelectString方法的具体用法?C++ CComboBox::SelectString怎么用?C++ CComboBox::SelectString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComboBox
的用法示例。
在下文中一共展示了CComboBox::SelectString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SelectColorScheme
void CConfigAppearance::SelectColorScheme(const COLOR_SCHEME *pColorScheme)
{
CComboBox *pFontList = static_cast<CComboBox*>(GetDlgItem(IDC_FONT));
CComboBox *pFontSizeList = static_cast<CComboBox*>(GetDlgItem(IDC_FONT_SIZE));
SetColor(COL_BACKGROUND, pColorScheme->BACKGROUND);
SetColor(COL_BACKGROUND_HILITE, pColorScheme->BACKGROUND_HILITE);
SetColor(COL_BACKGROUND_HILITE2, pColorScheme->BACKGROUND_HILITE2);
SetColor(COL_PATTERN_TEXT, pColorScheme->TEXT_NORMAL);
SetColor(COL_PATTERN_TEXT_HILITE, pColorScheme->TEXT_HILITE);
SetColor(COL_PATTERN_TEXT_HILITE2, pColorScheme->TEXT_HILITE2);
SetColor(COL_PATTERN_INSTRUMENT, pColorScheme->TEXT_INSTRUMENT);
SetColor(COL_PATTERN_VOLUME, pColorScheme->TEXT_VOLUME);
SetColor(COL_PATTERN_EFF_NUM, pColorScheme->TEXT_EFFECT);
SetColor(COL_SELECTION, pColorScheme->SELECTION);
SetColor(COL_CURSOR, pColorScheme->CURSOR);
SetColor(COL_CURRENT_ROW_NORMAL, pColorScheme->ROW_NORMAL); // // //
SetColor(COL_CURRENT_ROW_EDIT, pColorScheme->ROW_EDIT);
SetColor(COL_CURRENT_ROW_PLAYING, pColorScheme->ROW_PLAYING);
m_strFont = pColorScheme->FONT_FACE;
m_iFontSize = pColorScheme->FONT_SIZE;
pFontList->SelectString(0, m_strFont.data());
pFontSizeList->SelectString(0, FormattedW(L"%i", m_iFontSize));
}
示例2: OnInitDialog
BOOL CConfigSound::OnInitDialog()
{
CPropertyPage::OnInitDialog();
CComboBox *pSampleRate = static_cast<CComboBox*>(GetDlgItem(IDC_SAMPLE_RATE));
CComboBox *pSampleSize = static_cast<CComboBox*>(GetDlgItem(IDC_SAMPLE_SIZE));
CComboBox *pDevices = static_cast<CComboBox*>(GetDlgItem(IDC_DEVICES));
CSliderCtrl *pBufSlider = static_cast<CSliderCtrl*>(GetDlgItem(IDC_BUF_LENGTH));
CSliderCtrl *pBassSlider = static_cast<CSliderCtrl*>(GetDlgItem(IDC_BASS_FREQ));
CSliderCtrl *pTrebleSliderFreq = static_cast<CSliderCtrl*>(GetDlgItem(IDC_TREBLE_FREQ));
CSliderCtrl *pTrebleSliderDamping = static_cast<CSliderCtrl*>(GetDlgItem(IDC_TREBLE_DAMP));
CSliderCtrl *pVolumeSlider = static_cast<CSliderCtrl*>(GetDlgItem(IDC_VOLUME));
// Set ranges
pBufSlider->SetRange(1, MAX_BUFFER_LEN);
pBassSlider->SetRange(16, 4000);
pTrebleSliderFreq->SetRange(20, 20000);
pTrebleSliderDamping->SetRange(0, 90);
pVolumeSlider->SetRange(0, 100);
CSettings *pSettings = theApp.GetSettings();
// Read settings
switch (pSettings->Sound.iSampleRate) {
case 11025: pSampleRate->SelectString(0, _T("11 025 Hz")); break;
case 22050: pSampleRate->SelectString(0, _T("22 050 Hz")); break;
case 44100: pSampleRate->SelectString(0, _T("44 100 Hz")); break;
case 48000: pSampleRate->SelectString(0, _T("48 000 Hz")); break;
case 96000: pSampleRate->SelectString(0, _T("96 000 Hz")); break;
}
switch (pSettings->Sound.iSampleSize) {
case 16: pSampleSize->SelectString(0, _T("16 bit")); break;
case 8: pSampleSize->SelectString(0, _T("8 bit")); break;
}
pBufSlider->SetPos(pSettings->Sound.iBufferLength);
pBassSlider->SetPos(pSettings->Sound.iBassFilter);
pTrebleSliderFreq->SetPos(pSettings->Sound.iTrebleFilter);
pTrebleSliderDamping->SetPos(pSettings->Sound.iTrebleDamping);
pVolumeSlider->SetPos(pSettings->Sound.iMixVolume);
UpdateTexts();
CDSound *pDSound = theApp.GetSoundGenerator()->GetSoundInterface();
const int iCount = pDSound->GetDeviceCount();
for (int i = 0; i < iCount; ++i)
pDevices->AddString(pDSound->GetDeviceName(i));
pDevices->SetCurSel(pSettings->Sound.iDevice);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例3: OnInitDialog
BOOL CExpandLimitsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CComboBox *List = (CComboBox*)GetDlgItem(IDC_EXCLUDELIST);
size_t ListSize = 0;
const char* FirstString;
// Add the strings to the list box.
std::list<CScrollLimits>::const_iterator curNode;
for (curNode = m_World->GetScrollLimits().begin(); curNode != m_World->GetScrollLimits().end(); ++curNode)
{
List->AddString(curNode->ScriptName);
if(ListSize == 0)
FirstString = curNode->ScriptName;
++ListSize;
}
// Set the default selection.
if(ListSize)
{
List->SelectString(-1, FirstString);
m_ExcludeSelected = 0;
}
List = (CComboBox*)GetDlgItem(IDC_INCLUDELIST);
ListSize = 0;
// Add the strings to the list box.
for (curNode = m_World->GetScrollLimits().begin(); curNode != m_World->GetScrollLimits().end(); ++curNode)
{
List->AddString(curNode->ScriptName);
if(ListSize == 0)
FirstString = curNode->ScriptName;
++ListSize;
}
// Set the default selection.
if(ListSize)
{
List->SelectString(-1, FirstString);
m_IncludeSelected = 0;
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例4: MakeIntString
void CInstrumentEditorN163Wave::SelectInstrument(std::shared_ptr<CInstrument> pInst)
{
m_pInstrument = std::dynamic_pointer_cast<CInstrumentN163>(pInst);
ASSERT(m_pInstrument);
CComboBox *pSizeBox = static_cast<CComboBox*>(GetDlgItem(IDC_WAVE_SIZE));
CComboBox *pPosBox = static_cast<CComboBox*>(GetDlgItem(IDC_WAVE_POS));
pSizeBox->SelectString(0, MakeIntString(m_pInstrument->GetWaveSize()));
FillPosBox(m_pInstrument->GetWaveSize());
pPosBox->SetWindowText(MakeIntString(m_pInstrument->GetWavePos()));
/*
if (m_pInstrument->GetAutoWavePos()) {
CheckDlgButton(IDC_POSITION, 1);
GetDlgItem(IDC_WAVE_POS)->EnableWindow(FALSE);
}
else {
CheckDlgButton(IDC_POSITION, 0);
GetDlgItem(IDC_WAVE_POS)->EnableWindow(TRUE);
}
*/
if (m_pWaveEditor) {
m_pWaveEditor->SetInstrument(m_pInstrument);
m_pWaveEditor->SetLength(m_pInstrument->GetWaveSize());
}
m_iWaveIndex = 0;
PopulateWaveBox();
}
示例5: OnInitDialog
BOOL CFileDialogEx::OnInitDialog()
{
CFileDialog::OnInitDialog();
// The edit box
HWND editBox = ::GetDlgItem (*(this->GetParent ()), edt1);
// The combo box
CComboBox combo;
combo.Attach (::GetDlgItem (*this, IDC_DIRLIST));
// Insert the strings
char text[512];
text[0] = 0;
HKEY hKey;
DWORD type = REG_SZ;
DWORD size;
if (RegCreateKey (HKEY_CURRENT_USER, _RegistryPath.c_str (), &hKey) == ERROR_SUCCESS)
{
uint i;
for (i=0; i<PATH_REMEBERED_SIZE; i++)
{
size = 512;
if (RegQueryValueEx (hKey, toString (i).c_str (), 0, &type, (LPBYTE)text, &size) == ERROR_SUCCESS)
combo.InsertString (-1, text);
}
if (m_ofn.lpstrInitialDir)
combo.SelectString (-1, m_ofn.lpstrInitialDir);
}
combo.Detach ();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例6: OnInitDialog
LRESULT CPrefsLanguageDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
CComboBox langList = GetDlgItem(IDC_LANGUAGE_LIST);
for (int i = 0; i < g_numLanguages; i++)
{
int index = langList.AddString(languageCodes[i].name);
langList.SetItemData(index, i);
}
// Set currently selected language
{
for (int i = 0; i < g_numLanguages; i++)
{
ASSERT(0);
#if 0
if (wcscmp(languageCodes[i].code, m_pPrefs->m_systemLanguage.c_str()) == 0)
break;
#endif
}
if (i < g_numLanguages)
{
langList.SelectString(-1, languageCodes[i].name);
}
}
CheckRadioButton(IDC_SYSTEM_SUBTITLES, IDC_SYSTEM_SUBTITLES+1, IDC_SYSTEM_SUBTITLES+m_pPrefs->m_systemOverdubOrSubtitle);
CheckDlgButton(IDC_SYSTEM_CAPTIONS, m_pPrefs->m_systemCaptions);
CheckDlgButton(IDC_SYSTEM_AUDIODESC, m_pPrefs->m_systemAudioDesc);
return 1; // Let the system set the focus
}
示例7: initComboBox
//
// Helper utility to initialize a combo box from an array of text
//
static void initComboBox(CComboBox &b, const TCHAR *list[], int count, const TCHAR *initial)
{
b.Clear();
for (int i = 0; i < count; i += 2)
//The odd index are the display text, the even index are the keys
b.SetItemDataPtr(b.AddString(list[i + 1]), (void *)(list[i]));
b.SelectString(0, initial);
}
示例8: OnInitDialog
BOOL CConfigAppearance::OnInitDialog()
{
CPropertyPage::OnInitDialog();
const CSettings *pSettings = theApp.GetSettings();
m_strFont = pSettings->Appearance.strFont; // // //
CDC *pDC = GetDC();
if (pDC != NULL) {
LOGFONTW LogFont = { }; // // //
LogFont.lfCharSet = ANSI_CHARSET;
EnumFontFamiliesExW(pDC->m_hDC, &LogFont, (FONTENUMPROC)EnumFontFamExProc, (LPARAM)this, 0);
ReleaseDC(pDC);
}
CComboBox *pFontSizeList = static_cast<CComboBox*>(GetDlgItem(IDC_FONT_SIZE));
CComboBox *pItemsBox = static_cast<CComboBox*>(GetDlgItem(IDC_COL_ITEM));
for (int i = 0; i < COLOR_ITEM_COUNT; ++i) {
pItemsBox->AddString(conv::to_wide(COLOR_ITEMS[i]).data());
}
pItemsBox->SelectString(0, conv::to_wide(COLOR_ITEMS[0]).data());
m_iSelectedItem = 0;
m_iColors[COL_BACKGROUND] = pSettings->Appearance.iColBackground;
m_iColors[COL_BACKGROUND_HILITE] = pSettings->Appearance.iColBackgroundHilite;
m_iColors[COL_BACKGROUND_HILITE2] = pSettings->Appearance.iColBackgroundHilite2;
m_iColors[COL_PATTERN_TEXT] = pSettings->Appearance.iColPatternText;
m_iColors[COL_PATTERN_TEXT_HILITE] = pSettings->Appearance.iColPatternTextHilite;
m_iColors[COL_PATTERN_TEXT_HILITE2] = pSettings->Appearance.iColPatternTextHilite2;
m_iColors[COL_PATTERN_INSTRUMENT] = pSettings->Appearance.iColPatternInstrument;
m_iColors[COL_PATTERN_VOLUME] = pSettings->Appearance.iColPatternVolume;
m_iColors[COL_PATTERN_EFF_NUM] = pSettings->Appearance.iColPatternEffect;
m_iColors[COL_SELECTION] = pSettings->Appearance.iColSelection;
m_iColors[COL_CURSOR] = pSettings->Appearance.iColCursor;
m_iColors[COL_CURRENT_ROW_NORMAL] = pSettings->Appearance.iColCurrentRowNormal; // // //
m_iColors[COL_CURRENT_ROW_EDIT] = pSettings->Appearance.iColCurrentRowEdit;
m_iColors[COL_CURRENT_ROW_PLAYING] = pSettings->Appearance.iColCurrentRowPlaying;
m_iFontSize = pSettings->Appearance.iFontSize; // // //
m_bPatternColors = pSettings->Appearance.bPatternColor; // // //
m_bDisplayFlats = pSettings->Appearance.bDisplayFlats; // // //
pItemsBox = static_cast<CComboBox*>(GetDlgItem(IDC_SCHEME));
for (auto *scheme : COLOR_SCHEMES)
pItemsBox->AddString(scheme->NAME);
for (int pt : FONT_SIZES) // // //
pFontSizeList->AddString(conv::to_wide(conv::from_int(pt)).data());
pFontSizeList->SetWindowTextW(conv::to_wide(conv::from_int(m_iFontSize)).data());
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例9: OnInitDialog
BOOL CSplitKeyboardDlg::OnInitDialog()
{
CComboBox *pCombo;
const auto pDoc = CFamiTrackerDoc::GetDoc();
pCombo = static_cast<CComboBox*>(GetDlgItem(IDC_COMBO_SPLIT_NOTE));
for (auto n : KEY_NAME)
pCombo->AddString(conv::to_wide(n).data());
pCombo->SetCurSel(m_iSplitNote != -1 ? (value_cast(ft0cc::doc::pitch_from_midi(m_iSplitNote)) - 1) : 0);
pCombo = static_cast<CComboBox*>(GetDlgItem(IDC_COMBO_SPLIT_OCTAVE));
for (int i = 0; i < OCTAVE_RANGE; ++i)
pCombo->AddString(conv::to_wide(conv::from_int(i)).data());
pCombo->SetCurSel(m_iSplitNote != -1 ? ft0cc::doc::oct_from_midi(m_iSplitNote) : 3);
pCombo = static_cast<CComboBox*>(GetDlgItem(IDC_COMBO_SPLIT_CHAN));
pCombo->AddString(KEEP_INST_STRING);
pCombo->SetCurSel(0);
auto *pSCS = FTEnv.GetSoundChipService();
int i = 0;
pDoc->GetModule()->GetChannelOrder().ForeachChannel([&] (stChannelID ch) {
pCombo->AddString(conv::to_wide(pSCS->GetChannelFullName(ch)).data());
if (m_iSplitChannel == ch)
pCombo->SetCurSel(i + 1);
++i;
});
pCombo = static_cast<CComboBox*>(GetDlgItem(IDC_COMBO_SPLIT_INST));
pCombo->AddString(KEEP_INST_STRING);
pDoc->GetModule()->GetInstrumentManager()->VisitInstruments([&] (const CInstrument &, std::size_t i) {
pCombo->AddString(conv::to_wide(conv::from_int_hex(i, 2)).data());
});
if (pCombo->SelectString(-1, FormattedW(L"%02X", m_iSplitInstrument)) == CB_ERR)
pCombo->SelectString(-1, KEEP_INST_STRING);
pCombo = static_cast<CComboBox*>(GetDlgItem(IDC_COMBO_SPLIT_TRSP));
for (int j = -MAX_TRANSPOSE; j <= MAX_TRANSPOSE; ++j)
pCombo->AddString(FormattedW(L"%+d", j));
pCombo->SelectString(-1, FormattedW(L"%+d", m_iSplitTranspose));
CheckDlgButton(IDC_CHECK_SPLIT_ENABLE, m_bSplitEnable ? BST_CHECKED : BST_UNCHECKED);
OnBnClickedCheckSplitEnable();
return CDialog::OnInitDialog();
}
示例10: SetLogClass
void CLogClassFilterEditDlg::SetLogClass(int comboID, UINT c)
{
CComboBox combo = (HWND)GetDlgItem(comboID);
CStringW desc = helper::GetLogLevelDescription(c);
if (combo.SelectString(0, desc) == CB_ERR)
{
combo.SetWindowText(desc);
}
}
示例11: OnOK
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();
}
示例12: AddFontName
void CConfigAppearance::AddFontName(std::wstring_view Name) // // //
{
if (Name.size() >= LF_FACESIZE) // // //
return;
CComboBox *pFontList = static_cast<CComboBox*>(GetDlgItem(IDC_FONT));
pFontList->AddString(Name.data());
if (m_strFont == Name)
pFontList->SelectString(0, Name.data());
}
示例13: SetSelectedFontName
void CFcFontBar::SetSelectedFontName(const CString& SelectString, BOOL bEnable)
{
CComboBox* pCb = (CComboBox*)GetDlgItem(ID_FORMAT_FONTNAME);
ASSERT_VALID(pCb);
if (SelectString.GetLength() > 0)
pCb->SelectString(-1, SelectString);
else
pCb->SetCurSel(-1);
pCb->EnableWindow(bEnable);
}
示例14: DoDataExchange
// **************************************************************************
// 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);
}
}
示例15:
void CInstrumentEditorN163Wave::SelectInstrument(int Instrument)
{
m_pInstrument = (CInstrumentN163*)GetDocument()->GetInstrument(Instrument);
CComboBox *pSizeBox = (CComboBox*)GetDlgItem(IDC_WAVE_SIZE);
CComboBox *pPosBox = (CComboBox*)GetDlgItem(IDC_WAVE_POS);
CString SizeStr;
SizeStr.Format(_T("%i"), m_pInstrument->GetWaveSize());
pSizeBox->SelectString(0, SizeStr);
FillPosBox(m_pInstrument->GetWaveSize());
CString PosStr;
PosStr.Format(_T("%i"), m_pInstrument->GetWavePos());
pPosBox->SetWindowText(PosStr);
/*
if (m_pInstrument->GetAutoWavePos()) {
CheckDlgButton(IDC_POSITION, 1);
GetDlgItem(IDC_WAVE_POS)->EnableWindow(FALSE);
}
else {
CheckDlgButton(IDC_POSITION, 0);
GetDlgItem(IDC_WAVE_POS)->EnableWindow(TRUE);
}
*/
if (m_pWaveEditor) {
m_pWaveEditor->SetInstrument(m_pInstrument);
m_pWaveEditor->SetLength(m_pInstrument->GetWaveSize());
}
CSpinButtonCtrl *pIndexSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_INDEX_SPIN);
CSpinButtonCtrl *pWavesSpin = (CSpinButtonCtrl*)GetDlgItem(IDC_WAVES_SPIN);
int WaveCount = m_pInstrument->GetWaveCount();
pIndexSpin->SetRange(0, WaveCount - 1);
pIndexSpin->SetPos(0);
pWavesSpin->SetPos(WaveCount - 1);
m_iWaveIndex = 0;
}