当前位置: 首页>>代码示例>>C++>>正文


C++ CListBox::SetCurSel方法代码示例

本文整理汇总了C++中CListBox::SetCurSel方法的典型用法代码示例。如果您正苦于以下问题:C++ CListBox::SetCurSel方法的具体用法?C++ CListBox::SetCurSel怎么用?C++ CListBox::SetCurSel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CListBox的用法示例。


在下文中一共展示了CListBox::SetCurSel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: OnInitDialog

BOOL CFanmotorDlg::OnInitDialog()
{
	CDialog::OnInitDialog();
   	
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon

	aboutdlg = NULL;
	debugdlg = NULL;
	detaildlg = NULL;
	otpdlg = NULL;
	otpcaldlg = NULL;
	evaluationdlg = NULL;
	testdlg = NULL;
	inttest = NULL;
	
	//CFanmotorDlg* pParent = (CFanmotorDlg*)m_pParent;
	//*****************************************************
	/* set virtual_board=false for read back IC reg value.
	set virtual_board=true for read back virtual reg value.*/
	virtual_board=false;
	fOTP=0;
	//*****************************************************
		if(virtual_board==true)
		InitVirtualBoard();


    m_EDIT_ADDR.SetWindowText(_T("92"));
	m_EDIT_SCL_FREQ.Format(_T("400kHz"));
	UpdateData(FALSE);
	//m_EDIT_PWM_FREQ.Format(_T("25kHz"));
	//UpdateData(FALSE);
	m_EDIT_PWM_DC.Format(_T("%.0f%s"),duty_cycle1,"%");
	UpdateData(FALSE);
	m_EDIT_PWM_DC2.Format(_T("%d%s"),duty_cycle2,"%");
	UpdateData(FALSE);

	m_EDIT_MODE.Format(_T("ON"));
	UpdateData(FALSE);
	m_CHECK_MODE.SetCheck(1);
	//OnBnClickedButtonStart();
	

	linkupbridge();
	Sleep(1000);
	CListBox* listBoxBridges = (CListBox*)GetDlgItem(IDC_BRIDGE_LISTBOX);
    listBoxBridges->SetCurSel(0);//?

	//linkupdevice();

	return TRUE;  // return TRUE  unless you set the focus to a control
}
开发者ID:ChenChengCC,项目名称:test2,代码行数:52,代码来源:FanmotorDlg.cpp

示例2: SelectString

static void SelectString( CListBox &list, const RString &sToSelect )
{
	for( int i=0; i<list.GetCount(); i++ )
	{
		CString s;
		list.GetText( i, s );
		if( s == sToSelect )
		{
			list.SetCurSel( i );
			break;
		}
	}
}
开发者ID:Ancaro,项目名称:stepmania,代码行数:13,代码来源:LanguagesDlg.cpp

示例3: BuildList

void CPhotoProjectsTypeDlg::BuildList(void)
{
	/*
	// Get the name to match.
	*/

	CString csOldName;
	if (m_pOldInfo != NULL)
	{
		csOldName = m_pOldInfo->GetName();
	}

	int nNewSel = 0;
	CListBox* pList;

	if ((pList = (CListBox*)GetDlgItem(IDC_PHOTOPROJECTS_LIST)) != NULL)
	{
		pList->SetRedraw(FALSE);
		pList->ResetContent();
		int nPhotoPrjs = m_List.PhotoProjects();
		for (int nPhotoPrj = 0; nPhotoPrj < nPhotoPrjs; nPhotoPrj++)
		{
			CPhotoPrjData* pPhotoPrj = (CPhotoPrjData*)m_List.PhotoProject(nPhotoPrj);
			ASSERT(pPhotoPrj != NULL);

			int nIndex = pList->AddString(pPhotoPrj->m_pSubAreaData[0]->GetName());
			if (nIndex >= 0)
			{
				pList->SetItemData(nIndex, (DWORD)pPhotoPrj);

				if (pPhotoPrj->m_pSubAreaData[0]->GetName() == csOldName)
				{
					nNewSel = nIndex;
				}
			}
		}

	/*
	// Set the initial entry as necessary.
	*/

		if (pList->GetCount() > 0)
		{
			pList->SetCurSel(nNewSel);
			OnSelchangePhotoProjectsList();
		}
		pList->SetRedraw(TRUE);
	}


}
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:51,代码来源:PhPrjDlg.cpp

示例4: GetActiveBridge

bool CFanmotorDlg::GetActiveBridge(CString& BridgeID)
{
    CListBox* listBoxBridges = (CListBox*)GetDlgItem(IDC_BRIDGE_LISTBOX);
    listBoxBridges->SetCurSel(0);
	BridgeID = L"";
	if (listBoxBridges->GetCurSel() < 0) 
	{
		DisplayInforMessageBox((LPCWSTR)L"Error", L"Select Active BRIDGE!");
		return false;
	}
    CBridgeInfo* bridgeInfo = (CBridgeInfo*)listBoxBridges->GetItemDataPtr(listBoxBridges->GetCurSel());
	BridgeID = bridgeInfo->BridgeID;
	return true;
}
开发者ID:ChenChengCC,项目名称:test2,代码行数:14,代码来源:FanmotorDlg.cpp

示例5: BuildList

void CEnvelopeTypeDialog::BuildList(void)
{
	CListBox* pList;
	if ((pList = (CListBox*)GetDlgItem(IDC_ENVELOPE_LIST)) != NULL)
	{
		/*
		// Get the name to match.
		*/

		CString csOldName;
		if (m_pOldInfo != NULL)
		{
			csOldName = m_pOldInfo->GetName();
		}

		int nNewSel = 0;

		pList->SetRedraw(FALSE);
		pList->ResetContent();
		int nLabels = m_List.Labels();
		for (int nLabel = 0; nLabel < nLabels; nLabel++)
		{
			CLabelData* pLabel = m_List.Label(nLabel);
			ASSERT(pLabel != NULL);

			if (pLabel != NULL)
			{
				int nIndex = pList->AddString(pLabel->GetName());
				if (nIndex >= 0)
				{
					pList->SetItemData(nIndex, (DWORD)pLabel);
				/*
				// If the label matches the name coming in,
				// remember its position.
				*/
					if (pLabel->GetName() == csOldName)
					{
						nNewSel = nIndex;
					}
				}
			}
		}
		// Always start with the first label.
		pList->SetCurSel(nNewSel);
		pList->SetRedraw(TRUE);

		OnSelchangeEnvelopeList();				// Do this by hand.
	}
}
开发者ID:jimmccurdy,项目名称:ArchiveGit,代码行数:49,代码来源:ENVTYPE.CPP

示例6: ErrorMsg

void CFanmotorDlg::ErrorMsg(int r) 
{
	CString msg = Bridge->GetStatusMsg(r);
    AfxMessageBox(msg, MB_ICONERROR | MB_OK, 0);
    if (r == 7) // If device is busy by another application
    {
		CListBox* listBoxBridges = (CListBox*)GetDlgItem(IDC_BRIDGE_LISTBOX);
		listBoxBridges->SetCurSel(-1);
		CListBox* listBoxDevices = (CListBox*)GetDlgItem(IDC_DEVICE_LISTBOX);
        listBoxDevices->ResetContent();
	//	ResetPowerSettings();
	//	ResetSpeedSettings();
        Bridge->AbortTransfer(); // Deactivate any Bridge (free port handle)
    }
}
开发者ID:ChenChengCC,项目名称:test2,代码行数:15,代码来源:FanmotorDlg.cpp

示例7: iter

void
ArxDbgUtils::fillListBox(const SdStrList& slist, CListBox& lb, int defIndex)
{
    BOOL addedOne = FALSE;

    lb.ResetContent();
    SdStrListIterator iter(slist);
    for(; !iter.done(); iter.next()) {
        addedOne = TRUE;
        lb.AddString(iter.item());
    }

    if ( addedOne )
        lb.SetCurSel(defIndex);
}
开发者ID:FengLuanShuangWu,项目名称:AutoCADPlugin-HeatSource,代码行数:15,代码来源:UiUtils.cpp

示例8: OnAddButton

void CDizzyDialog::OnAddButton() 
{
	UpdateData(true);
	CListBox* pListBox = (CListBox*) GetDlgItem(IDC_INPUT_LIST);
	CAxisRotation inputRotation;
	bool bValidString = inputRotation.ParseString(m_strInput);
	if (bValidString) {
		int iOffset = pListBox->GetCurSel();
		if (iOffset != LB_ERR) {
			pListBox->InsertString(iOffset+1,m_strInput);
			pListBox->SetCurSel(iOffset+1);
		}	
		else {
			pListBox->AddString(m_strInput);
			pListBox->SetCurSel(pListBox->GetCount()-1);
		}
		RecalculateRotation();
		m_strInput = "";
		UpdateData(false);
	}
	else {
		::AfxMessageBox("Input must be a valid axis-angle rotation!");
	}
}
开发者ID:Floppy,项目名称:Vapour,代码行数:24,代码来源:DizzyDialog.cpp

示例9: linkupdevice

void CFanmotorDlg::linkupdevice()
{
	//CString BridgeID;
    CListBox* listBoxBridges = (CListBox*)GetDlgItem(IDC_BRIDGE_LISTBOX);
    listBoxBridges->SetCurSel(0);
	
	setpower5v();
	setspeed400k();
/*	setpower3v();

	if (GetActiveBridge(BridgeID))
	{
		CListBox* listBoxBridges = (CListBox*)GetDlgItem(IDC_DEVICE_LISTBOX);
		listBoxBridges->ResetContent();
		SetCursor(AfxGetApp()->LoadStandardCursor(IDC_WAIT));
		VARIANT data = Bridge->GetDeviceList(BridgeID);
		SetCursor(AfxGetApp()->LoadStandardCursor(IDC_ARROW));
		//Process Result
		int lastError = Bridge->GetBridgeStatus(1);
		if (lastError != 34) // failure of bus scanning
			ErrorMsg(lastError);
		else // bus scanned successfully
		{
			SAFEARRAY FAR *List = data.parray;
			long highBound, lowBound, count;
			SafeArrayGetUBound(List, 1, &highBound);
			SafeArrayGetLBound(List, 1, &lowBound);
			count = highBound - lowBound + 1;
			if (count == 1) { //only 0s element, which indicates amount of devices found
				DisplayInforMessageBox((LPCWSTR)L"Error", L"No I2C devices can be found");
				return;
			}

			BYTE HUGEP *pDevice;
			CString strDevice;
			SafeArrayAccessData(List, (void HUGEP* FAR*)&pDevice);
			for (int i = 1; i < count; i++){
				int device = pDevice[i];
				strDevice.Format(L"0x%02X",device);
				listBoxBridges->AddString(strDevice);
			}
			SafeArrayUnaccessData(List);
		}
	}
   CListBox* listBoxDevices = (CListBox*)GetDlgItem(IDC_DEVICE_LISTBOX);
   listBoxDevices->SetCurSel(0);
   setspeed100k();  */
}
开发者ID:ChenChengCC,项目名称:test2,代码行数:48,代码来源:FanmotorDlg.cpp

示例10: OnInitDialog

BOOL CScaleDialog::OnInitDialog()
{
  CDialog::OnInitDialog();

  CListBox* pListBox = static_cast<CListBox*>(GetDlgItem(IDC_SCALE_LIST));
  CString scaleStr;
  for(int i = 1 ; i <= 8 ; ++i)
  {
    scaleStr.Format(_T("Scale %d"), i);
    pListBox->AddString(scaleStr);
  }
  pListBox->SetCurSel(m_Scale);        // Set current scale

  return TRUE;  // return TRUE unless you set the focus to a control
  // EXCEPTION: OCX Property Pages should return FALSE
}
开发者ID:Trietptm-on-Coding-Algorithms,项目名称:CodeLibrary,代码行数:16,代码来源:ScaleDialog.cpp

示例11: OnDownButton

void CDizzyDialog::OnDownButton() 
{
	UpdateData(true);
	CListBox* pListBox = (CListBox*) GetDlgItem(IDC_INPUT_LIST);
	int iOffset = pListBox->GetCurSel();
	if ((iOffset != LB_ERR) && (iOffset != pListBox->GetCount()-1)) {
		CString strCurrent;
		pListBox->GetText(iOffset, strCurrent);
		pListBox->DeleteString(iOffset);
		iOffset++;
		pListBox->InsertString(iOffset, strCurrent);
		pListBox->SetCurSel(iOffset);
		RecalculateRotation();
	}
	UpdateData(false);
}
开发者ID:Floppy,项目名称:Vapour,代码行数:16,代码来源:DizzyDialog.cpp

示例12: InitChannelList

void CChannelSelectDlg::InitChannelList( int iChannel, int iMaxChannel )
{
	CListBox				*pListBox = (CListBox *)GetDlgItem( IDC_CHANNELLIST );
	CString					str;
	int						iN;


	for( iN = 0; iN < iMaxChannel; iN ++ )
	{
		str.Format( "Channel %d", iN );
		pListBox->AddString( str );
	}

	pListBox->SetCurSel( iChannel );
	pListBox->GetText( iChannel, str );
	GetDlgItem( IDC_SELLECTEDCHANNEL )->SetWindowText( str );
}
开发者ID:ChoiJS,项目名称:hi,代码行数:17,代码来源:ChannelSelectDlg.cpp

示例13: GetActiveDevice

bool CFanmotorDlg::GetActiveDevice(BYTE& DeviceAddress)
{
	DeviceAddress = 255;
	CListBox* listBoxDevices = (CListBox*)GetDlgItem(IDC_DEVICE_LISTBOX);
	listBoxDevices->SetCurSel(0);
	if (listBoxDevices->GetCurSel() < 0) {
		DisplayInforMessageBox((LPCWSTR)L"Error", L"Select Active DEVICE!\r\nPress \"Device List\" button and Select Device");
		return false;
	}
	CString s;
	int n = listBoxDevices->GetTextLen(listBoxDevices->GetCurSel());
	WCHAR *ch, *buf = s.GetBuffer(n);
	listBoxDevices->GetText(listBoxDevices->GetCurSel(), buf);
	DeviceAddress = (BYTE)wcstol(buf,&ch,16);
	s.ReleaseBuffer();
	return true;
}
开发者ID:ChenChengCC,项目名称:test2,代码行数:17,代码来源:FanmotorDlg.cpp

示例14: Init

//----------------------------------------------------------------------
void MapSizeDlg::Init()
{
	CListBox* pListBox = (CListBox*)GetDlgItem( IDC_MAPSIZE );

	int index = pListBox->AddString( "60x60" );
	pListBox->SetItemData( index, 0 );

	index = pListBox->AddString( "80x80" );
	pListBox->SetItemData( index, 1 );

	index = pListBox->AddString( "100x100" );
	pListBox->SetItemData( index, 2 );

	index = pListBox->AddString( "120x120" );
	pListBox->SetItemData( index, 3 );
	//magic 21022011 begin
	index = pListBox->AddString( "140x140" );
	pListBox->SetItemData( index, 4 );

	index = pListBox->AddString( "160x160" );
	pListBox->SetItemData( index, 5 );
	//magic 23022011 begin
	index = pListBox->AddString( "180x180" );
	pListBox->SetItemData( index, 6 );

	index = pListBox->AddString( "200x200" );
	pListBox->SetItemData( index, 7 );
	//magic 23022011 end

	//magic 24032012 begin
	index = pListBox->AddString( "220x220" );
	pListBox->SetItemData( index, 8 );

	index = pListBox->AddString( "240x240" );
	pListBox->SetItemData( index, 9 );

	index = pListBox->AddString( "260x260" );
	pListBox->SetItemData( index, 10 );

	index = pListBox->AddString( "280x280" );
	pListBox->SetItemData( index, 11 );
	//magic 24032012 end
	//magic 21022011 end
	pListBox->SetCurSel( mapSize );
}
开发者ID:Echelon9,项目名称:mechcommander2-open,代码行数:46,代码来源:mapsizedlg.cpp

示例15: upDate

void DLGSkill::upDate()
{
    CListBox* pLB = (CListBox*) GetDlgItem(IDC_SkillList);
    int oriSel = pLB->GetCurSel();
    pLB->ResetContent();

    char buf[256];
    for(int i = 0; CSkill::getInfoCount() > i; i++)
    {
        CSkillInfo* pInfo = CSkill::getInfo(i);
        sprintf_s(buf, sizeof(buf), "[%d] %s", i, pInfo->getName().c_str());
        CString str;
        str = buf;
        pLB->AddString(str);
    }

    pLB->SetCurSel(oriSel);
}
开发者ID:hjqqq,项目名称:Forever,代码行数:18,代码来源:DLGSkill.cpp


注:本文中的CListBox::SetCurSel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。