MCPcopy Create free account
hub / github.com/SOUI2/soui / SetSel

Method SetSel

SOUI/src/control/STreeView.cpp:579–622  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

577 }
578
579 void STreeView::SetSel(HTREEITEM hItem,BOOL bNotify/*=FALSE*/)
580 {
581 if(!m_adapter) return;
582
583 if(bNotify)
584 {
585 EventTVSelChanging evt(this);
586 evt.bCancel = FALSE;
587 evt.hOldSel = m_hSelected;
588 evt.hNewSel = hItem;
589 FireEvent(evt);
590 if(evt.bCancel)
591 {//Cancel SetSel and restore selection state
592 return;
593 }
594 }
595
596 if(m_hSelected == hItem)
597 return;
598
599 SItemPanel *pItem = GetItemPanel(m_hSelected);
600 if(pItem)
601 {
602 pItem->GetFocusManager()->ClearFocus();
603 pItem->ModifyItemState(0,WndState_Check);
604 RedrawItem(pItem);
605 }
606 m_hSelected = hItem;
607 pItem = GetItemPanel(m_hSelected);
608 if(pItem)
609 {
610 pItem->ModifyItemState(WndState_Check,0);
611 RedrawItem(pItem);
612 }
613
614 if(bNotify)
615 {
616 EventTVSelChanged evt(this);
617 evt.hOldSel = m_hSelected;
618 evt.hNewSel = hItem;
619 FireEvent(evt);
620 }
621
622 }
623
624 void STreeView::OnKeyDown(TCHAR nChar, UINT nRepCnt, UINT nFlags)
625 {

Callers

nothing calls this directly

Calls 2

ClearFocusMethod · 0.80
ModifyItemStateMethod · 0.80

Tested by

no test coverage detected