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


C++ CControlUI::SetFocus方法代码示例

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


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

示例1: SelectItem

bool CDropDownUI::SelectItem(int iIndex)
{
	if( iIndex == m_iCurSel ) return true;
	if( m_iCurSel >= 0 ) {
		CControlUI* pControl = static_cast<CControlUI*>(m_items[m_iCurSel]);
		IListItemUI* pListItem = static_cast<IListItemUI*>(pControl->GetInterface(_T("ListItem")));
		if( pListItem != NULL ) pListItem->Select(false);
		m_iCurSel = -1;
	}
	if( m_items.GetSize() == 0 ) return false;
	if( iIndex < 0 ) iIndex = 0;
	if( iIndex >= m_items.GetSize() ) iIndex = m_items.GetSize() - 1;
	CControlUI* pControl = static_cast<CControlUI*>(m_items[iIndex]);
	if( !pControl->IsVisible() ) return false;
	if( !pControl->IsEnabled() ) return false;
	IListItemUI* pListItem = static_cast<IListItemUI*>(pControl->GetInterface(_T("ListItem")));
	if( pListItem == NULL ) return false;
	m_iCurSel = iIndex;
	pControl->SetFocus();
	pListItem->Select(true);
	if( m_pManager != NULL ) m_pManager->SendNotify(pControl, _T("itemclick"));
	if( m_pManager != NULL ) m_pManager->SendNotify(this, _T("itemselect"));
	Invalidate();
	return true;
}
开发者ID:kovrov,项目名称:scrap,代码行数:25,代码来源:UICombo.cpp

示例2: SelectItem

bool CListUI::SelectItem(int iIndex)
{
   if( iIndex == m_iCurSel ) return true;
   // We should first unselect the currently selected item
   if( m_iCurSel >= 0 ) {
      CControlUI* pControl = GetItem(m_iCurSel);
      if( pControl != NULL ) {
         IListItemUI* pListItem = static_cast<IListItemUI*>(pControl->GetInterface(_T("ListItem")));
         if( pListItem != NULL ) pListItem->Select(false);
      }
   }
   // Now figure out if the control can be selected
   // TODO: Redo old selected if failure
   CControlUI* pControl = GetItem(iIndex);
   if( pControl == NULL ) return false;
   if( !pControl->IsVisible() ) return false;
   if( !pControl->IsEnabled() ) return false;
   IListItemUI* pListItem = static_cast<IListItemUI*>(pControl->GetInterface(_T("ListItem")));
   if( pListItem == NULL ) return false;
   m_iCurSel = iIndex;
   if( !pListItem->Select(true) ) {
      m_iCurSel = -1;
      return false;
   }
   pControl->SetFocus();
   if( m_pManager != NULL ) {
      m_pManager->SendNotify(pControl, _T("itemclick"));
      m_pManager->SendNotify(this, _T("itemselect"));
   }
   Invalidate();
   return true;
}
开发者ID:0buffer,项目名称:DirectUI,代码行数:32,代码来源:UIList.cpp

示例3: SelectItem

	bool CComboUI::SelectItem(int iIndex, bool bTakeFocus)
	{
		if( iIndex == m_iCurSel ) return true;
		int iOldSel = m_iCurSel;
		if( m_iCurSel >= 0 ) {
			CControlUI* pControl = static_cast<CControlUI*>(m_items[m_iCurSel]);
			if( !pControl ) return false;
			IListItemUI* pListItem = static_cast<IListItemUI*>(pControl->GetInterface(_T("ListItem")));
			if( pListItem != NULL ) pListItem->Select(false);
			m_iCurSel = -1;
		}
		if( iIndex < 0 ) return false;
		if( m_items.GetSize() == 0 ) return false;
		if( iIndex >= m_items.GetSize() ) iIndex = m_items.GetSize() - 1;
		CControlUI* pControl = static_cast<CControlUI*>(m_items[iIndex]);
		if( !pControl || !pControl->IsEnabled() ) return false;
		IListItemUI* pListItem = static_cast<IListItemUI*>(pControl->GetInterface(_T("ListItem")));
		if( pListItem == NULL ) return false;
		m_iCurSel = iIndex;
		if( m_pWindow != NULL || bTakeFocus ) pControl->SetFocus();
		pListItem->Select(true);
		if( m_pManager != NULL ) m_pManager->SendNotify(this, DUI_MSGTYPE_ITEMSELECT, m_iCurSel, iOldSel);
		Invalidate();

		return true;
	}
开发者ID:bambotuz,项目名称:DuiLib_Ultimate,代码行数:26,代码来源:UICombo.cpp

示例4: ViCbSetFocus

//   BOOL ViCbSetFocus(VApiHandle hWnd)
SQInteger ViCbSetFocus(HSQUIRRELVM v)
{
	SQInteger      nargs         = sq_gettop(v);
	SQInteger      Handle        = 0;
	CControlUI*    pCtrl         = NULL;
	LPCTSTR        pstrName      = NULL;
	if (!v || 1 + 1 != nargs) {goto _Exit_;}
	if (OT_INTEGER != sq_gettype(v, 2)) {goto _Exit_;}
	
	sq_getinteger(v, 2, &Handle);
	pCtrl = QiHwHandleToCtrl(Handle);
	if (!pCtrl) {goto _Exit_;}
	pCtrl->SetFocus();
	
_Exit_:
	sq_pushbool(v, TRUE);
	return 1;
}
开发者ID:eriser,项目名称:kdguigl,代码行数:19,代码来源:Scriptapi.cpp


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