本文整理汇总了C++中CComboBox::SetCurSel方法的典型用法代码示例。如果您正苦于以下问题:C++ CComboBox::SetCurSel方法的具体用法?C++ CComboBox::SetCurSel怎么用?C++ CComboBox::SetCurSel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComboBox
的用法示例。
在下文中一共展示了CComboBox::SetCurSel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnInitDialog
BOOL CoptimizerDlg::OnInitDialog()
{
CSliderCtrl *Slider = (CSliderCtrl *)GetDlgItem(IDC_SLIDER_CUSTOM);
CComboBox *CBox = (CComboBox *)GetDlgItem(IDC_COMBO_PRESET);
CProgressCtrl *ProgressBar = (CProgressCtrl*)GetDlgItem(IDC_PROGRESS);
CString buf;
CDialog::OnInitDialog();
SetIcon(m_hIcon, TRUE);
SetIcon(m_hIcon, FALSE);
CheckRadioButton(IDC_RADIO_PRESET, IDC_RADIO_CUSTOM, IDC_RADIO_PRESET);
Slider->SetRange(1000, 10000);
Slider->SetTicFreq(1000);
CBox->ResetContent();
for(int i = 0; i < NUMSTRINGS; i++) {
buf.LoadString(IDS_STRING1 + i);
CBox->AddString(buf);
}
CBox->SetCurSel(2);
SetSlider(Slider, 2);
ProgressBar->SetRange(0, 100);
return TRUE;
}
示例2: OnInitDialog
BOOL CDAuditWizard::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
CComboBox* pcbProcName;
pcbProcName = (CComboBox*) GetDlgItem(IDC_COMBO_PROCESS);
if (pcbProcName != NULL)
{
CStringList pr_list;
CEnumProcess Enum(&pr_list);
Enum.EnumProcesses();
pr_list.AddTail("*");
POSITION pos;
for(pos = pr_list.GetHeadPosition(); pos != NULL;)
{
pcbProcName->AddString(pr_list.GetNext(pos));
}
pcbProcName->SetCurSel(0);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例3: 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;
}
示例4: OnInitDialog
BOOL CHMIRunDlg::OnInitDialog()
{
CDialog::OnInitDialog();
// TODO: Add extra initialization here
int number = gCfgFile.GetTowerNumber();
CComboBox *pCombo = (CComboBox *)GetDlgItem(IDC_COMBO_RUN);
int row;
CString str;
for(row=0; row<number; row++)
{
str.Format("风机%d", row + 1);
pCombo->InsertString(row, str);
}
pCombo->InsertString(row, "机舱");
pCombo->SetCurSel(0);
CIPAddressCtrl *pIPAddr = (CIPAddressCtrl *)GetDlgItem(IDC_IPADDRESS_RUN);
pIPAddr->SetAddress(gCfgFile.GetTowerIP(0));
CHMIDlg *pDlg = (CHMIDlg *)(GetParent()->GetParent());
pDlg->SetTipString(__T("加载配置文件成功!"));
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例5: OnInitDialog
BOOL CDisplayResolutionPane::OnInitDialog() {
CPropertyPage::OnInitDialog();
UInt8 isSelected;
CComboBox* pCB = (CComboBox*) GetDlgItem(IDC_COMBO1);
VisualGraphics* theVisualGraphics;
theVisualGraphics = VisualGraphics::getInstance();
theVisualGraphics->evaluateFullscreenDisplayResolution();
//theVisualGraphics->gatherAvailableDisplayResolutions();
//theVisualGraphics->resetDisplayResolutionIterIndex();
char showStr[32];
UInt16 count = 0;
UInt16 selIdx = 0;
while(theVisualGraphics->getNextAvailableDisplayResolution(showStr, &isSelected)) {
if (isSelected == 1) {
selIdx = count;
}
if (pCB->AddString(showStr) == CB_ERR) {
AfxMessageBox("AnError occurred while adding mon res item to combo list.");
}
count++;
}
pCB->SetCurSel(selIdx);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zurückgeben
}
示例6: OnTextChanged
LRESULT FavHubGeneralPage::OnTextChanged(WORD /*wNotifyCode*/, WORD wID, HWND /*hWndCtl*/, BOOL& /*bHandled*/) {
if (loading)
return 0;
if (wID == IDC_HUBADDR) {
CComboBox combo;
combo.Attach(GetDlgItem(IDC_ENCODING));
tstring address;
address.resize(1024);
address.resize(GetDlgItemText(IDC_HUBADDR, &address[0], 1024));
if (AirUtil::isAdcHub(Text::fromT(address))) {
if (!hideShare)
ctrlProfile.EnableWindow(true);
combo.SetCurSel(4); // select UTF-8 for ADC hubs
combo.EnableWindow(false);
}
else {
ctrlProfile.EnableWindow(false);
combo.EnableWindow(true);
}
combo.Detach();
}
return TRUE;
}
示例7: OnInitDialog
LRESULT CPrefsConnectionDlg::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
CComboBox speed = GetDlgItem(IDC_CONNECTION_SPEED);
speed.AddString("28.8 Kbps");
speed.AddString("33.6 Kbps");
speed.AddString("56.6 Kbps");
speed.AddString("Single ISDN (64 Kbps)");
speed.AddString("Dual ISDN (128 Kbps)");
speed.AddString("DSL/Cable (256 Kbps)");
speed.AddString("DSL/Cable (384 Kbps)");
speed.AddString("DSL/Cable (512 Kbps)");
speed.AddString("DSL/Cable (768 Kbps)");
speed.AddString("1 Mbps Cable");
speed.AddString("T1 (1.5 Mbps)");
speed.AddString("Office LAN (10 Mbps and above)");
for (int i = 0; i < NUMBITRATES; i++)
{
if (m_pPrefs->m_systemBitrate <= BitRates[i])
{
speed.SetCurSel(i);
break;
}
}
return 1; // Let the system set the focus
}
示例8: OnBnClickedConnectCheck
//===========================================================================
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;
}
}
示例9: OnBnClickedButtonExecute
void CFirstFollowDlg::OnBnClickedButtonExecute()
{
// TODO: 在此添加控件通知处理程序代码
this->grammar = new Grammar();
if(this->productionList.size() == 0)
return;
StreamHelper::formateStream(this->productionList);
this->grammar->createGrammar(this->productionList);
this->grammar->initGrammar();
vector<char> nonTermSymbols;
this->grammar->getAllNonTermSymbols(nonTermSymbols);
CComboBox *combobox = (CComboBox*) GetDlgItem(IDC_COMBO_NONTERM);
for (size_t i=0;i<nonTermSymbols.size();i++)
{
string s;
s.push_back(nonTermSymbols[i]);
combobox->AddString(s.c_str());
}
//获取全部非终结符的first and follow gather
this->grammar->getAllFirstGather(this->allFirstGather);
this->grammar->getAllFollowGather(this->allFollowGather);
combobox->SetCurSel(0);
this->OnCbnSelchangeComboNonterm();
}
示例10: OnFviewFmtBest
void ViewFilesDialog::OnFviewFmtBest(void)
{
CComboBox* pCombo = (CComboBox*) GetDlgItem(IDC_FVIEW_FORMATSEL);
pCombo->SetCurSel(0); // best is always at the top
OnFormatSelChange();
pCombo->SetFocus();
}
示例11: FindComPort
// 查找串口
void CPMSRSet::FindComPort()
{
HKEY hKey;
st_CommPara.usCommNum = 0; // 串口数量
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Hardware\\DeviceMap\\SerialComm"), NULL, KEY_READ, &hKey) == ERROR_SUCCESS)
{
TCHAR szPortName[256], szComName[256];
DWORD dwLong, dwSize;
int nCount = 0;
CComboBox* pCombo = (CComboBox*)GetDlgItem(IDC_COMBO1);
pCombo->ResetContent();
while (true)
{
dwLong = dwSize = 256;
if (RegEnumValue(hKey, nCount, szPortName, &dwLong, NULL, NULL, (PUCHAR)szComName, &dwSize) == ERROR_NO_MORE_ITEMS)
break;
pCombo->InsertString(nCount, szComName);
nCount++;
st_CommPara.usCommNum++;
}
RegCloseKey(hKey);
pCombo->SetCurSel(0);
}
}
示例12: GetFindText
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;
}
示例13: AddHelper
static void AddHelper(CComboBox& combobox, STRING_VECTOR& availableHelpers, const CString& helper, const CString& selected = L"")
{
availableHelpers.push_back(helper);
int idx = combobox.AddString(helper);
if (selected == helper)
combobox.SetCurSel(idx);
}
示例14: OnInitDialog
BOOL CNewTextureDlg::OnInitDialog()
{
CDialog::OnInitDialog();
CComboBox *pComboBox = (CComboBox*) GetDlgItem(IDC_D3DFMT_COMBO);
TCHAR strFmtLabel[MAX_PATH] = {0};
for( int i = 0; i < fmtInfoArraySize; i++ )
{
// Construct the texture label
StringCchPrintf( strFmtLabel, MAX_PATH, TEXT("%s %i-bit: %s"),
fmtInfoArray[i].strType,
fmtInfoArray[i].nBitsPerTexel,
fmtInfoArray[i].strName );
// Add the label to the combo box
pComboBox->AddString(strFmtLabel);
// Set default selection to A8R8G8B8
if( fmtInfoArray[i].fmt == D3DFMT_A8R8G8B8 )
pComboBox->SetCurSel( i );
}
OnChangeTextureType();
OnChangeFormat();
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例15: OnInitDialog
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;
}