本文整理汇总了C++中CComboBox::SetItemData方法的典型用法代码示例。如果您正苦于以下问题:C++ CComboBox::SetItemData方法的具体用法?C++ CComboBox::SetItemData怎么用?C++ CComboBox::SetItemData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComboBox
的用法示例。
在下文中一共展示了CComboBox::SetItemData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AddAlignmentOptions
void CDebugMemorySearch::AddAlignmentOptions(CComboBox & ctrl)
{
int Index = ctrl.AddString("32 bits (aligned)");
ctrl.SetItemData(Index, _32Bit);
Index = ctrl.AddString("16bits (aligned)");
ctrl.SetItemData(Index, _16Bit);
Index = ctrl.AddString("8bits");
ctrl.SetCurSel(Index);
ctrl.SetItemData(Index, _8Bit);
}
示例2: AddAlignmentOptions
void CDebugMemorySearch::AddAlignmentOptions (CComboBox & ctrl)
{
/*int Index =*/ ctrl.AddString("32 bits (aligned)");
g_Notify->BreakPoint(__FILE__,__LINE__);
#ifdef tofix
ctrl.SetItemData(Index,_32Bit);
Index = ctrl.AddString("16bits (aligned)");
ctrl.SetItemData(Index,_16Bit);
Index = ctrl.AddString("8bits");
ctrl.SetCurSel(Index);
ctrl.SetItemData(Index,_8Bit);
#endif
}
示例3: OnSetActive
//----------------------------- FUNCTION -------------------------------------*
BOOL PropGSDModule::OnSetActive()
{
// TODO: Add your specialized code here and/or call the base class
CComboBox* pUsedModules = (CComboBox*)GetDlgItem(IDC_COMBO_USED_MODULES);
if (pUsedModules != NULL) {
arModules.RemoveAll();
pUsedModules->ResetContent();
m_pModule->GetUsedModules(&arModules);
for (int i = 0; i < arModules.GetSize(); i++) {
CDP_Module* pModule = (CDP_Module*)arModules.GetAt(i);
if (pModule->GetUserPrmLen() != 0) {
CString szName;
szName.Format(_T("%d: "), i+1);
szName += pModule->GetModuleName();
int index = pUsedModules->AddString(szName);
pUsedModules->SetItemData(index, (DWORD)pModule);
}
}
pUsedModules->SetCurSel(0);
m_pSelModule = NULL;
}
OnSelchangeUsedModules();
CreateExtUserParams();
return CPropertyPage::OnSetActive();
}
示例4: AppendNotesToControl
void AppendNotesToControl(CComboBox& combobox, const modplug::tracker::note_t noteStart, const modplug::tracker::note_t noteEnd)
//------------------------------------------------------------------------------------------------------------------
{
const modplug::tracker::note_t upperLimit = bad_min(CountOf(szDefaultNoteNames)-1, noteEnd);
for(modplug::tracker::note_t note = noteStart; note <= upperLimit; ++note)
combobox.SetItemData(combobox.AddString(szDefaultNoteNames[note]), note);
}
示例5: OnInitDialog
BOOL CMidiSetupDlg::OnInitDialog()
//--------------------------------
{
MIDIINCAPS mic;
CComboBox *combo;
CPropertyPage::OnInitDialog();
// Flags
if (m_dwMidiSetup & MIDISETUP_RECORDVELOCITY) CheckDlgButton(IDC_CHECK1, MF_CHECKED);
if (m_dwMidiSetup & MIDISETUP_RECORDNOTEOFF) CheckDlgButton(IDC_CHECK2, MF_CHECKED);
if (m_dwMidiSetup & MIDISETUP_AMPLIFYVELOCITY) CheckDlgButton(IDC_CHECK3, MF_CHECKED);
if (m_dwMidiSetup & MIDISETUP_TRANSPOSEKEYBOARD) CheckDlgButton(IDC_CHECK4, MF_CHECKED);
if (m_dwMidiSetup & MIDISETUP_MIDITOPLUG) CheckDlgButton(IDC_MIDI_TO_PLUGIN, MF_CHECKED);
if (m_dwMidiSetup & MIDISETUP_MIDIMACROCONTROL) CheckDlgButton(IDC_MIDI_MACRO_CONTROL, MF_CHECKED);
if (m_dwMidiSetup & MIDISETUP_MIDIVOL_TO_NOTEVOL) CheckDlgButton(IDC_MIDIVOL_TO_NOTEVOL, MF_CHECKED);
if (m_dwMidiSetup & MIDISETUP_RESPONDTOPLAYCONTROLMSGS) CheckDlgButton(IDC_MIDIPLAYCONTROL, MF_CHECKED);
if (m_dwMidiSetup & MIDISETUP_PLAYPATTERNONMIDIIN) CheckDlgButton(IDC_MIDIPLAYPATTERNONMIDIIN, MF_CHECKED);
// Midi In Device
if ((combo = (CComboBox *)GetDlgItem(IDC_COMBO1)) != NULL)
{
UINT ndevs = midiInGetNumDevs();
for (UINT i=0; i<ndevs; i++)
{
mic.szPname[0] = 0;
if (midiInGetDevCaps(i, &mic, sizeof(mic)) == MMSYSERR_NOERROR)
combo->SetItemData(combo->AddString(mic.szPname), i);
}
combo->SetCurSel((m_nMidiDevice == MIDI_MAPPER) ? 0 : m_nMidiDevice);
}
m_SpinSpd.SetRange(2, 6);
m_SpinPat.SetRange(64, 256);
return TRUE;
}
示例6: onInitDialog
LRESULT RecipePanel::onInitDialog(UINT/*uMsg*/, WPARAM/*wParam*/, LPARAM/*lParam*/, BOOL&/*bHandled*/)
{
SetWindowText(_T("Filter View"));
updateCharList();
{
CComboBox cb = GetDlgItem(IDC_RECIPECOMBO);
auto recipes = m_recipeLoader.getRecipes();
cb.ResetContent();
int item = cb.AddString(_T("-"));
for (unsigned int i = 0; i < recipes.size(); i++) {
std::tstring name = recipes[i];
if ((item = cb.AddString(name.c_str())) != CB_ERR) {
cb.SetItemData(item, i);
}
}
cb.SetCurSel(0);
}
signalSettingsChanged();
return 0;
}
示例7: 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
}
示例8: GetDlgItem
void CTxMsgWndJ1939::vInitializeNmFields(void)
{
//Set the properties of the field first
m_omCurAddress.vSetBase(BASE_HEXADECIMAL);
m_omCurAddress.vSetSigned(false);
m_omCurAddress.LimitText(2);
m_omEcuName.vSetBase(BASE_HEXADECIMAL);
m_omEcuName.vSetSigned(false);
m_omEcuName.LimitText(16);
m_omDLCEdit.LimitText(4);
m_bNM = TRUE;
CButton* pButton = (CButton*) GetDlgItem(IDC_RADIO_NM);
pButton->SetCheck(BST_CHECKED);
//Populate the values
pButton = (CButton*)GetDlgItem(IDC_RQST_ADDRESS);
pButton->SetCheck(BST_UNCHECKED);
pButton = (CButton*)GetDlgItem(IDC_CMD_ADDRESS);
pButton->SetCheck(BST_UNCHECKED);
pButton = (CButton*)GetDlgItem(IDC_CLAIM_ADDRESS);
pButton->SetCheck(BST_CHECKED);
CComboBox* pComboBox = (CComboBox*)GetDlgItem(IDC_COMBO_NODE);
int nIndex = pComboBox->AddString(m_sClientParams.m_acName);
pComboBox->SetItemData(nIndex, m_sClientParams.m_byAddress);
pComboBox->SetCurSel(nIndex);
m_omEcuName.vSetValue(m_sClientParams.m_unEcuName);
m_omCurAddress.vSetValue(m_sClientParams.m_byAddress);
UpdateData(TRUE);
}
示例9: updateDimensionList
void FindView::updateDimensionList()
{
int item = -1;
CComboBox cb = GetDlgItem(IDC_DIMENSION_COMBO);
cb.ResetContent();
std::map<unsigned int, std::tstring> dimensionNames;
g_DBManager.Lock();
g_DBManager.GetDimensions(dimensionNames);
sqlite::ITablePtr pT = m_db->ExecTable(_T("SELECT DISTINCT dimensionid FROM tToons"));
g_DBManager.UnLock();
// Add named dimensions.
for (std::map<unsigned int, std::tstring>::iterator it = dimensionNames.begin(); it != dimensionNames.end(); ++it)
{
if ((item = cb.AddString(it->second.c_str())) != CB_ERR)
{
cb.SetItemData(item, it->first);
}
}
// Add un-named dimensions.
for (unsigned int i = 0; i < pT->Rows(); ++i)
{
unsigned int dimId = boost::lexical_cast<unsigned int>(pT->Data(i, 0));
std::tstring dimName;
if (dimensionNames.find(dimId) != dimensionNames.end())
{
continue; // Skip named ones.
}
else
{
dimName = _T("Unknown Dimension");
if (dimId > 0)
{
dimName += STREAM2STR(" (0x" << std::hex << dimId << ")");
}
}
if ((item = cb.AddString(dimName.c_str())) != CB_ERR)
{
cb.SetItemData(item, dimId);
}
}
}
示例10: updateCharList
void FindView::updateCharList(unsigned int dimension_id)
{
CComboBox cb = GetDlgItem(IDC_CHARCOMBO);
cb.ResetContent();
int item = cb.AddString(_T("-"));
cb.SetItemData(item, 0);
boost::format sql("SELECT DISTINCT owner FROM tItems I JOIN tToons T ON I.owner = T.charid WHERE dimensionid = %1% ORDER BY T.charname");
sql % dimension_id;
g_DBManager.Lock();
sqlite::ITablePtr pT = m_db->ExecTable(sql.str());
g_DBManager.UnLock();
if (pT != NULL)
{
for (unsigned int i = 0; i < pT->Rows(); i++)
{
try
{
unsigned int id = boost::lexical_cast<unsigned int>(pT->Data(i, 0));
g_DBManager.Lock();
std::tstring name = g_DBManager.GetToonName(id);
g_DBManager.UnLock();
if (name.empty())
{
name = from_ascii_copy(pT->Data(i, 0));
}
if ((item = cb.AddString(name.c_str())) != CB_ERR)
{
cb.SetItemData(item, id);
}
}
catch (boost::bad_lexical_cast&/*e*/)
{
// This is here because of a wierd but that appears to be SQLite's fault.
LOG("Error in updateCharList(). Bad lexical cast at row " << i << ".");
continue;
}
}
}
}
示例11: AppendNotesToControlEx
void AppendNotesToControlEx(CComboBox& combobox, const module_renderer* const pSndFile /* = nullptr*/, const modplug::tracker::instrumentindex_t nInstr/* = MAX_INSTRUMENTS*/)
//----------------------------------------------------------------------------------------------------------------------------------
{
const modplug::tracker::note_t noteStart = (pSndFile != nullptr) ? pSndFile->GetModSpecifications().noteMin : 1;
const modplug::tracker::note_t noteEnd = (pSndFile != nullptr) ? pSndFile->GetModSpecifications().noteMax : NoteMax;
for(modplug::tracker::note_t nNote = noteStart; nNote <= noteEnd; nNote++)
{
if(pSndFile != nullptr && nInstr != MAX_INSTRUMENTS)
combobox.SetItemData(combobox.AddString(pSndFile->GetNoteName(nNote, nInstr).c_str()), nNote);
else
combobox.SetItemData(combobox.AddString(szDefaultNoteNames[nNote-1]), nNote);
}
for(modplug::tracker::note_t nNote = NoteMinSpecial-1; nNote++ < NoteMaxSpecial;)
{
if(pSndFile == nullptr || pSndFile->GetModSpecifications().HasNote(nNote) == true)
combobox.SetItemData(combobox.AddString(szSpecialNoteNames[nNote-NoteMinSpecial]), nNote);
}
}
示例12: OnInitDialog
BOOL CBerkeleyView::OnInitDialog()
{
CDialogEx::OnInitDialog();
// TODO: Add extra initialization here
CComboBox* pBox = (CComboBox*)GetDlgItem(IDC_DATA_TYPE);
pBox->AddString(_T("String"));
pBox->SetItemData(0, DataDecoder::eDTString);
pBox->AddString(_T("Bitmap"));
pBox->SetItemData(0, DataDecoder::eDTBitmap);
pBox->AddString(_T("LZ"));
pBox->SetItemData(0, DataDecoder::eDTLZ);
pBox->AddString(_T("RLE"));
pBox->SetItemData(0, DataDecoder::eDTRLE);
pBox->SelectString(0, _T("String"));
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例13: addAMTKListByType
void WINAPI addAMTKListByType(CComboBox &cList, WORD wAccessType)
{
int i;
cList.ResetContent();
for (i = 0; i < AMTK_ITEM_ALL_NUM; i++) {
if (l_tAMTKItems[i].wType & wAccessType) {
cList.SetItemData(cList.AddString(l_tAMTKItems[i].lpcszName), i);
}
}
}
示例14: OnInitDialog
BOOL CDlgRename::OnInitDialog()
{
CDialog::OnInitDialog();
CComboBox* pCBox = (CComboBox *) GetDlgItem( IDC_CMB_FORMATS );
int nDefaultIndex;
theApp.m_nFormatCount;
if( theApp.m_nFormatCount != 0 )
{
for( int i = 0 ; i < theApp.m_nFormatCount ; i++ )
{
CFormat* pFormat = new CFormat();
pFormat->Load( i + 1 );
if( i == theApp.m_nDefaultFormat )
{
nDefaultIndex = i;
}
int nIndex = pCBox->AddString( pFormat->m_strName );
pCBox->SetItemData( nIndex , (DWORD) pFormat );
}
pCBox->SetCurSel( nDefaultIndex );
if( m_bSingleFile )
{
SetMode( FORMAT_FREE );
}
else
{
// Griser le mode Nom libre
GetDlgItem( IDC_FORMAT_FREE )->EnableWindow( FALSE );
SetMode( FORMAT_PREDEFINED );
}
}
else
{
if( m_bSingleFile )
{
// Disable the combo
GetDlgItem( IDC_CMB_FORMATS )->EnableWindow( FALSE );
GetDlgItem( IDC_FORMAT_PREDEFINED )->EnableWindow( FALSE );
SetMode( FORMAT_FREE );
}
else
{
// No format availbale => can't rename
CString strMsg = theApp.LoadTranslatedString( "IdsErrorFormatNotAvailable" );
MessageBox( strMsg , NULL, MB_ICONWARNING );
EndDialog(FALSE);
}
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例15:
void KG3DAnimationContainer::FillAnimationComboBox(CComboBox& ComboBox)
{
ComboBox.ResetContent();
LPCTSTR pszAniName = NULL;
for (int i = 0; i < static_cast<int>(m_Clips.size()); i++)
{
m_Clips[i]->GetName(&pszAniName);
ComboBox.InsertString(i, pszAniName);
ComboBox.SetItemData(i, reinterpret_cast<DWORD_PTR>(m_Clips[i]));
}
}