本文整理匯總了C++中GetCurSel函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetCurSel函數的具體用法?C++ GetCurSel怎麽用?C++ GetCurSel使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GetCurSel函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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;
}
示例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;
}
示例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];
}
示例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);
}
示例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);
}
示例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;
}
}
示例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;
}
示例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);
}
示例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;
}
示例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 "";
}
}
示例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));
}
示例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;
}
示例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 );
}
示例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;
}
示例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);
}