本文整理汇总了C++中COptionTreeItem::Activate方法的典型用法代码示例。如果您正苦于以下问题:C++ COptionTreeItem::Activate方法的具体用法?C++ COptionTreeItem::Activate怎么用?C++ COptionTreeItem::Activate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COptionTreeItem
的用法示例。
在下文中一共展示了COptionTreeItem::Activate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnKeyDown
void COptionTreeList::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// Declare variables
COptionTreeItem* otiItem;
CRect rcClient;
// Get client rectangle
GetClientRect(rcClient);
// Validate option
if (m_otOption == NULL)
{
CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
return;
}
// See if disabled
if (m_otOption->IsDisableInput() || !m_otOption->IsWindowEnabled())
{
CWnd::OnKeyDown(nChar, nRepCnt, nFlags);
return;
}
switch (nChar)
{
case VK_TAB:
// -- Shift
if (GetKeyState(VK_SHIFT) < 0)
{
// -- -- Focus next
otiItem = m_otOption->GetFocusedItem();
if (otiItem != NULL && !otiItem->IsRootLevel())
{
m_otOption->FocusPrev();
}
// -- -- Activate
otiItem = m_otOption->GetFocusedItem();
if (otiItem != NULL && !otiItem->IsRootLevel() && !otiItem->IsReadOnly())
{
otiItem->Activate();
}
Invalidate();
UpdateWindow();
}
// -- No shift
else
{
// -- -- Focus next
otiItem = m_otOption->GetFocusedItem();
if (otiItem != NULL && !otiItem->IsRootLevel())
{
m_otOption->FocusNext();
}
// -- -- Activate
otiItem = m_otOption->GetFocusedItem();
if (otiItem != NULL && !otiItem->IsRootLevel() && !otiItem->IsReadOnly())
{
otiItem->Activate();
}
Invalidate();
UpdateWindow();
}
break;
case VK_RETURN:
// -- Activate
otiItem = m_otOption->GetFocusedItem();
if (otiItem != NULL && !otiItem->IsRootLevel() && !otiItem->IsReadOnly())
{
otiItem->Activate();
}
break;
case VK_HOME:
// -- Focus on first item
if (m_otOption->FocusFirst())
{
Invalidate();
UpdateWindow();
}
break;
case VK_END:
// -- Focus on last item
if (m_otOption->FocusLast())
{
Invalidate();
//.........这里部分代码省略.........
示例2: OnLButtonDown
//.........这里部分代码省略.........
}
// -- Set capture
m_bColDrag = TRUE;
SetCapture();
m_lColumn = m_otOption->GetOrigin().x;
// -- Force redraw
Invalidate();
// -- Update window
UpdateWindow();
break;
case OT_HIT_EXPAND:
if ((otiItem = m_otOption->FindItem(point)) != NULL)
{
if (otiItem->GetChild() && !m_otOption->SendNotify(OT_NOTIFY_ITEMEXPANDING, otiItem))
{
// -- Expand
otiItem->Expand(!otiItem->IsExpanded());
// -- Update resize
UpdateResize();
// -- Force redraw
Invalidate();
// -- Update window
UpdateWindow();
// -- Check visible
CheckVisibleFocus();
}
}
break;
default:
if ((otiItem = m_otOption->FindItem(point)) != NULL)
{
// -- Get old focus
oliOldFocus = m_otOption->GetFocusedItem();
// -- Select items
m_otOption->SelectItems(NULL, FALSE);
// -- Select
otiItem->Select();
// -- Make sure new item
if (otiItem != oliOldFocus)
{
m_otOption->SendNotify(OT_NOTIFY_SELCHANGE, otiItem);
}
// -- Send notify
if (lHit == OT_HIT_ATTRIBUTE && !otiItem->IsRootLevel())
{
if (!m_otOption->SendNotify(OT_NOTIFY_PROPCLICK, otiItem) && !otiItem->IsReadOnly())
{
otiItem->Activate();
}
}
// -- Set focus item
m_otOption->SetFocusedItem(otiItem);
// -- Force redraw
Invalidate();
// -- Update window
UpdateWindow();
}
else
{
// -- Select items
m_otOption->SelectItems(NULL, FALSE);
// -- Set focus item
m_otOption->SetFocusedItem(NULL);
// -- Send notify
m_otOption->SendNotify(OT_NOTIFY_SELCHANGE);
// -- Force redraw
Invalidate();
// -- Update window
UpdateWindow();
}
break;
}
CWnd::OnLButtonDown(nFlags, point);
}