本文整理汇总了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
}
示例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;
}
}
}
示例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);
}
}
示例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;
}
示例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.
}
}
示例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)
}
}
示例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);
}
示例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!");
}
}
示例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(); */
}
示例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
}
示例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);
}
示例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 );
}
示例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;
}
示例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 );
}
示例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);
}