本文整理汇总了C++中GetCurSel函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCurSel函数的具体用法?C++ GetCurSel怎么用?C++ GetCurSel使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetCurSel函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetItemCount
BOOL CIETabBar::SetNextSel()
{
int nCount = GetItemCount();
int nCurSel = GetCurSel();
if (nCount >= 2)
{
if ( nCurSel == nCount-1 )//如果选择的是最后一个
{
SetCurSel(0);
}
else
{
SetCurSel(nCurSel + 1);
}
}
return TRUE;
}
开发者ID:gaozan198912,项目名称:myproject,代码行数:18,代码来源:IE8TabBar.cpp
示例2: GetCurSel
void CTabCtrlSSL::OnSelChanging (NMHDR* pNMHDR, LRESULT* pResult) {
// Notify derived classes that the selection is changing.
int nIndex = GetCurSel ();
if (nIndex == -1)
return;
OnDeactivatePage (nIndex, m_nPageIDs[nIndex]);
// Save the input focus and hide the old page.
TabDelete tabDelete = m_tabs[nIndex];
CTabPageSSL* pDialog = tabDelete.pTabPage;
if (pDialog != NULL) {
m_hFocusWnd[nIndex] = ::GetFocus ();
pDialog->ShowWindow (SW_HIDE);
}
*pResult = 0;
}
开发者ID:autocaddesk,项目名称:NtripCaster,代码行数:18,代码来源:TabCtrlSSL.cpp
示例3: ASSERT
CString COdbcValueComboBox::GetSelectedValueKey() const
{
ASSERT(GetSafeHwnd());
int nSel = GetCurSel();
if (nSel == -1)
return _T("");
// else
int nKey = GetItemData(nSel);
ASSERT(nKey >= 0 && nKey < m_aKeys.GetSize());
if (nKey < 0 || nKey >= m_aKeys.GetSize())
return _T("");
return m_aKeys[nKey];
}
开发者ID:Fox-Heracles,项目名称:TodoList,代码行数:18,代码来源:odbcvaluecombobox.cpp
示例4: GetCurSel
FONTITEM_PPG* CFontComboBox::GetFontItem(int sel)
{
if (sel == -1)
sel = GetCurSel();
if (sel == -1)
{
CString str;
GetWindowText( str );
sel = FindString( -1, str );
if (sel == CB_ERR)
sel = 0;
}
ASSERT( GetItemData(sel) );
return (FONTITEM_PPG*) GetItemData(sel);
}
开发者ID:Rupan,项目名称:winscp,代码行数:18,代码来源:ppgfont.cpp
示例5: GetJobCount
void CJobControlDlg::UpdateUI(int JobIdx)
{
int jobs = GetJobCount();
if (JobIdx < 0)
JobIdx = GetCurSel();
// update job positioning buttons
m_MoveUpBtn.EnableWindow(JobIdx > 0);
m_MoveDownBtn.EnableWindow(JobIdx >= 0 && JobIdx < jobs - 1);
// update job status buttons; don't let user change status of running job
bool StatChgOK = JobIdx >= 0 && !IsRunning(JobIdx);
m_PostponeBtn.EnableWindow(StatChgOK);
m_DeleteBtn.EnableWindow(StatChgOK);
// update job control buttons
bool BatchMode = m_Main->GetBatchMode(); // true if batch jobs are running
m_StartBtn.EnableWindow(jobs && !BatchMode && FindWaiting() >= 0);
m_AbortBtn.EnableWindow(jobs && BatchMode);
m_SkipBtn.EnableWindow(JobIdx >= 0 && BatchMode);
}
开发者ID:victimofleisure,项目名称:FFRend,代码行数:18,代码来源:JobControlDlg.cpp
示例6: SetSel
int CDomainListBox::SelectItem( int nSel, BOOL bSelected )
{
if( GetStyle( ) & LBS_MULTIPLESEL )
{
return SetSel( nSel, bSelected );
}
else
{
if( bSelected )
return SetCurSel( nSel );
else
{
if( GetCurSel() == nSel || -1 == nSel )
return SetCurSel( -1 );
}
return -1;
}
}
开发者ID:amikey,项目名称:tradingstrategyking,代码行数:18,代码来源:SetGroupDlg.cpp
示例7: GetCurSel
void CXTabCtrl::OnSelchange(NMHDR* pNMHDR, LRESULT* pResult)
{
// TODO: Add your control notification handler code here
int iNewTab = GetCurSel();
if (!IsTabEnabled(iNewTab))
{
SetCurSel(m_iSelectedTab);
}
else
{
TCITEM item;
CWnd* pWnd;
item.mask = TCIF_PARAM;
//** hide the current tab ---------
GetItem(m_iSelectedTab, &item);
pWnd = reinterpret_cast<CWnd*> (item.lParam);
ASSERT_VALID(pWnd);
pWnd->ShowWindow(SW_HIDE);
//** show the selected tab --------
GetItem(iNewTab, &item);
pWnd = reinterpret_cast<CWnd*> (item.lParam);
ASSERT_VALID(pWnd);
// 改变属性页的大小位置
CRect rc;
GetClientRect(rc);
rc.top += 20;
rc.bottom -= 3;
rc.left += 2;
rc.right -= 3;
pWnd->MoveWindow(&rc);
pWnd->ShowWindow(SW_SHOW);
// 发送到父窗口Tab项改变
GetParent()->SendMessage(WM_TAB_SEL_CHANGED,0,iNewTab);
}
*pResult = 0;
}
开发者ID:corefan,项目名称:nativetaskmanager,代码行数:44,代码来源:XTabCtrl.cpp
示例8: GetCurSel
void CListImpl::OnMouseMove(UINT wParam, WTL::CPoint pt)
{
if (m_last_pt == pt) // not moving
return;
m_last_pt = pt;
int index = GetCurSel();
WTL::CRect mainrc = GetHittestDivideRect(2 * index);
WTL::CRect seconrc = GetHittestDivideRect(2 * index + 1);
if (PtInRect(&mainrc, pt))
{
if (m_highlightstat == 1)
return;
SetClassLong(m_hWnd, GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND));
::SetCursor(LoadCursor(NULL, IDC_HAND));
m_highlightstat = 1;
Invalidate(FALSE);
return;
}
if (PtInRect(&seconrc, pt))
{
if (m_highlightstat == 2)
return;
SetClassLong(m_hWnd, GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_HAND));
SetCursor(LoadCursor(NULL, IDC_HAND));
m_highlightstat = 2;
Invalidate(FALSE);
return;
}
int bhightlightorg = m_highlightstat;
m_highlightstat = 0;
SetClassLong(m_hWnd, GCL_HCURSOR, (LONG)LoadCursor(NULL, IDC_ARROW));
SetCursor(LoadCursor(NULL, IDC_ARROW));
if (bhightlightorg != m_highlightstat)
Invalidate(FALSE);
}
开发者ID:Strongc,项目名称:playasa,代码行数:43,代码来源:ListImpl.cpp
示例9: GetCurSel
BOOL CTDLFindTaskExpressionListCtrl::DeleteSelectedRule()
{
int nRow = GetCurSel();
if (nRow != -1 && CanDeleteSelectedCell())
{
DeleteItem(nRow);
m_aSearchParams.RemoveAt(nRow);
ValidateListData();
SetCurSel(nRow);
EnsureVisible(nRow, FALSE);
return TRUE;
}
return FALSE;
}
开发者ID:jithuin,项目名称:infogeezer,代码行数:19,代码来源:TDLFindTaskExpressionListCtrl.cpp
示例10: GetSelectedClass
// Gets the selected class from the listbox
CString CClassList::GetSelectedClass()
{
// Get the current selection
int nSelString=GetCurSel();
if (nSelString != LB_ERR)
{
// Get the string for the current selection
CString sString;
GetText(nSelString, sString);
// Return the string
return sString;
}
else
{
// Return an empty string
return "";
}
}
开发者ID:Joincheng,项目名称:lithtech,代码行数:20,代码来源:ClassList.cpp
示例11: GetWindowText
void CUnitComboBox::Tran(CWnd *pWnd)
{
CString strText;
CString strUnit;
double dOut = 0;
double dOut1 = 0;
pWnd->GetWindowText(strText);
GetWindowText(strUnit);
double dIn = _tcstod(strText, '\0');
TransformToStd(dOut,strUnit,dIn);
int nIndex = GetCurSel();
if(CB_ERR != nIndex)
{
GetLBText(nIndex,strUnit);
}
TransformFromStd(dOut1,strUnit,dOut);
pWnd->SetWindowText(GetValue(dOut1));
}
开发者ID:uesoft,项目名称:AutoPFA,代码行数:19,代码来源:UnitComboBox.cpp
示例12: GetCurSel
void CListBoxEx::CreateComboControl()
{
if(IsWindow(ComboCtrl.m_hWnd))
return;
// create edit control
int iItem = GetCurSel();
if(iItem == LB_ERR)
return;
LBEXTITEMSTRUCT& lbis = Items[iItem];
if(lbis.iEditType != lbeChoices)
return;
CRect r;
GetItemRect(iItem, r);
r.left += iCaptionWidthPixels;
r.bottom += 80;
// create combo ctrl
ComboCtrl.Create(WS_CHILD | WS_VISIBLE | WS_VSCROLL | CBS_DROPDOWNLIST |
WS_TABSTOP, r, this, IDC_EDITPARAMETER);
// set font
HFONT hFont = (HFONT)GetStockObject(DEFAULT_GUI_FONT);
if (hFont == NULL)
hFont = (HFONT)GetStockObject(ANSI_VAR_FONT);
ComboCtrl.SendMessage(WM_SETFONT, (WPARAM)hFont);
// add strings to combo ctrl
CStringArray * pChoices = lbis.pChoices;
Assert(pChoices);
for(int i = 0; i < pChoices->GetSize(); i++)
ComboCtrl.AddString(pChoices->GetAt(i));
// set current selection in combo ctrl
ComboCtrl.SetCurSel(lbis.iDataValue);
ComboCtrl.SetForegroundWindow();
bControlActive = TRUE;
iControlItem = iItem;
}
开发者ID:steadyfield,项目名称:SourceEngine2007,代码行数:43,代码来源:listboxex.cpp
示例13: GetCurSel
TZNotePage *
TZNoteBook::GetActivePage( )
{
zSHORT nCurrIdx = GetCurSel( );
#ifdef DEBUG_ALL
TraceLineI( "TZNoteBook::GetActivePage: ", nCurrIdx );
#endif
TZNotePage *pCurrNotePage = m_pZNotePage;
while ( pCurrNotePage )
{
if ( pCurrNotePage->m_nTabIdx == nCurrIdx )
break;
pCurrNotePage = pCurrNotePage->m_pNext;
}
return( pCurrNotePage );
}
开发者ID:DeegC,项目名称:10d,代码行数:19,代码来源:TzCtlTAB.cpp
示例14: GetCurSel
bool CShaderListBox::DeleteCurrentShader()
{
bool ret = false;
int sel = GetCurSel();
if (sel != LB_ERR) {
if (DeleteShader(sel) != LB_ERR) {
ret = true;
if (GetCount() == sel) {
sel--;
}
if (sel >= 0) {
VERIFY(SetCurSel(sel) != LB_ERR);
}
} else {
ASSERT(FALSE);
}
}
return ret;
}
开发者ID:1ldk,项目名称:mpc-hc,代码行数:19,代码来源:PPageShaders.cpp
示例15: Input
/******************************************************************************
Function Name : OnRButtonDown
Description : The framework calls this member function when the user
right clicks on the list box
Input(s) : nFlags -
point -
Output : -
Functionality : Shows a popup menu to clear the contents of the listbox
Member of : CNotificListbox
Author(s) : Ravikumar Patil
Date Created : 27-03-2003
******************************************************************************/
void CNotificListbox::OnRButtonDown(UINT nFlags, CPoint point)
{
if (GetCount() > 0)
{
CMenu* pomContextMenu = new CMenu;
if (pomContextMenu != NULL)
{
// Load the Menu from the resource
pomContextMenu->DestroyMenu();
pomContextMenu->LoadMenu(IDM_OPERATION_LIST);
CMenu* pomSubMenu = pomContextMenu->GetSubMenu(0);
if (pomSubMenu != NULL)
{
CPoint omSrcPt = point;
ClientToScreen(&omSrcPt);
UINT unEnable;
/* If no item is selected, make "Clear" and "Delete" menu
items disabled */
if (GetCurSel() == -1)
{
unEnable = MF_BYCOMMAND | MF_DISABLED | MF_GRAYED;
}
else
{
unEnable = MF_BYCOMMAND | MF_ENABLED;
}
pomSubMenu->EnableMenuItem(IDM_OPRTN_CLEAR, unEnable);
pomSubMenu->EnableMenuItem(IDM_OPRTN_DELETE, unEnable);
pomSubMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_RIGHTBUTTON,
omSrcPt.x, omSrcPt.y, this, NULL);
}
delete pomContextMenu;
pomContextMenu = NULL;
}
}
CListBox::OnRButtonDown(nFlags, point);
}
开发者ID:Ferrere,项目名称:busmaster,代码行数:57,代码来源:NotificListbox.cpp
示例16: GetCurSel
void CPhonesListBox::OnEditItem()
{
CEditDialog dlg;
CString strItem;
int nIndex = GetCurSel ();
GetText (nIndex, strItem);
int nPos = strItem.Find (_T ('\t'));
dlg.m_strName = strItem.Left (nPos);
dlg.m_strPhone = strItem.Right (strItem.GetLength () - nPos - 1);
if (dlg.DoModal () == IDOK) {
strItem = dlg.m_strName + _T ("\t") + dlg.m_strPhone;
DeleteString (nIndex);
AddString (strItem);
}
SetFocus ();
}
开发者ID:jiayuehua,项目名称:MFCProgramming,代码行数:19,代码来源:PhonesListBox.cpp
示例17: GetCurSel
void CSkillEditListBox::OnLButtonDblClk(UINT nFlags, CPoint point)
{
//get the selected item's skill pointer
int iItem = GetCurSel();
CInvestigatorSkill* pInvestigatorSkill = (CInvestigatorSkill*)GetItemData(iItem);
//determine how to edit, depending on the item selected
if( pInvestigatorSkill->m_pSkill->m_SkillType == ANYSKILL )
{
CChooseSkillDlg ChooseSkillDlg;
ChooseSkillDlg.m_strCustomPrompt = "Please select a skill as a personal specialty";
ChooseSkillDlg.m_pInvestigator = m_pInvestigator;
ChooseSkillDlg.SetAsOccupational();
if( ChooseSkillDlg.DoModal() == IDOK )
{
//remove the ANYSKILL
m_pInvestigator->RemoveSkill( pInvestigatorSkill );
//reset the list
Initialise();
}
}
else
{
if( pInvestigatorSkill->m_pSkill->m_SkillType == SUBSKILL )
{
//determine x position of double click
CRect rcListBox;
GetClientRect( &rcListBox );
//prepare the selection rectangle
if( point.x < rcListBox.right - 40 || ((CSubSkill*)pInvestigatorSkill->m_pSkill)->m_strName.GetLength() == 0 )
BeginSpecialEditing();
else
BeginPercentageEditing();
}
else
BeginPercentageEditing();
}
//don't call base class
}
开发者ID:DrDub,项目名称:Byakhee,代码行数:42,代码来源:SkillEditListBox.cpp
示例18: OnRButtonUp
void CVideoSourceListBox::OnRButtonUp(UINT nFlags, CPoint point)
{
// TODO: Code für die Behandlungsroutine für Nachrichten hier einfügen und/oder Standard aufrufen
CMenu* cmPopupMenu;
int iIndex;
CString cStr;
bool bShowMenu=false;
cmPopupMenu=new CMenu;
cmPopupMenu->CreatePopupMenu();
if (GetCount())
{
iIndex=GetCurSel();
if (iIndex!=LB_ERR)
{
if (bShowMenu) cmPopupMenu->AppendMenu(MF_SEPARATOR,0);
if (bShowMenu) cmPopupMenu->AppendMenu(MF_SEPARATOR,0);
cStr=LoadString(IDS_VSLB_INFO);
cmPopupMenu->AppendMenu(MF_STRING,IDM_VIDEOINFORMATION,cStr);
bShowMenu=true;
if (bShowMenu) cmPopupMenu->AppendMenu(MF_SEPARATOR,0);
CUTF8 utf8Text(LoadString(STR_MAIN_A_EXTRBIN), CHARACTER_ENCODING_UTF8);
cmPopupMenu->AppendMenu(MF_STRING, IDM_EXTRACT_BINARY, //LoadString(STR_MAIN_A_EXTRBIN));
utf8Text.TStr());
}
}
if (bShowMenu)
{
ClientToScreen(&point);
cmPopupMenu->TrackPopupMenu(TPM_LEFTALIGN | TPM_LEFTBUTTON,point.x,point.y,this);
}
delete cmPopupMenu;
CEnhancedListBox::OnRButtonUp(nFlags, point);
CEnhancedListBox::OnRButtonUp(nFlags, point);
}
开发者ID:BrunoReX,项目名称:avimuxgui,代码行数:42,代码来源:VideoSourceListBox.cpp
示例19: GetClientRect
void CDropListBox::OnMouseMove(UINT nFlags, CPoint point)
{
//
// Is mouse within listbox
CRect rcClient;
GetClientRect( rcClient );
if( !rcClient.PtInRect( point ) )
{
ReleaseCapture();
GetParent()->SendMessage( WM_VRC_SETCAPTURE );
}
//
// Set selection item under mouse
int nPos = PointTest(point);
PLIST_ITEM pItem = (PLIST_ITEM)GetItemDataPtr(nPos);
if( nPos != LB_ERR && (DWORD)pItem != -1 && pItem != NULL)
{
if( GetCurSel() != nPos && !(pItem->state & ACBIS_DISABLED) )
{
SetCurSel( nPos );
}
}
//
// Check if we have auto scrolled
if( m_nLastTopIdx != GetTopIndex() )
{
int nDiff = m_nLastTopIdx - GetTopIndex();
m_nLastTopIdx = GetTopIndex();
SCROLLINFO info;
info.cbSize = sizeof(SCROLLINFO);
if( m_pDropWnd->GetScrollBarPtr()->GetScrollInfo( &info, SIF_ALL|SIF_DISABLENOSCROLL ) )
{
info.nPos = m_nLastTopIdx;
m_pDropWnd->GetScrollBarPtr()->SetScrollInfo( &info );
}
}
CListBox::OnMouseMove(nFlags, point);
}
开发者ID:killbug2004,项目名称:cosps,代码行数:42,代码来源:DropListBox.cpp
示例20: ASSERT
void CPropTreeItemCombo::DrawAttribute( CDC *pDC, const RECT &rc ) {
ASSERT( m_pProp != NULL );
// verify the window has been created
if( !IsWindow( m_hWnd ) ) {
TRACE0( "CPropTreeItemCombo::DrawAttribute() - The window has not been created\n" );
return;
}
pDC->SelectObject( IsReadOnly() ? m_pProp->GetNormalFont() : m_pProp->GetBoldFont() );
pDC->SetTextColor( RGB( 0, 0, 0 ) );
pDC->SetBkMode( TRANSPARENT );
CRect r = rc;
CString s;
LONG idx;
if( ( idx = GetCurSel() ) != CB_ERR ) {
GetLBText( idx, s );
} else {
s = _T( "" );
}
pDC->DrawText( s, r, DT_SINGLELINE | DT_VCENTER );
}
开发者ID:revelator,项目名称:Revelation,代码行数:20,代码来源:PropTreeItemCombo.cpp
注:本文中的GetCurSel函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论