![]() |
Removing contnets of TaskPanel |
Post Reply
|
| Author | |
Russ
Groupie
Joined: 21 September 2003 Location: Russian Federation Status: Offline Points: 28 |
Post Options
Thanks(0)
Quote Reply
Topic: Removing contnets of TaskPanelPosted: 01 November 2005 at 8:37am |
|
I need to dynamically change contents of TaskPanel. I need to remove entire groups with items and I have no luck so far.
code 1: //clear contents of the taskpanel CXTPTaskPanelItems* pItems = m_wndTaskPanel.GetGroups(); if (pItems) { int groupIndex = 0; int nGroupCount = pItems->GetCount(); while (groupIndex < nGroupCount) { CXTPTaskPanelItem* pItem = pItems->GetAt(groupIndex); if (pItem) { CXTPTaskPanelGroup* pGroup = reinterpret_cast<CXTPTaskPa nelGroup*>(pItem); int itemIndex = 0; int itemCount = pGroup->GetItemCount(); while (itemIndex < itemCount) { CXTPTaskPanelGroupItem* pGroupItem = pGroup->GetAt(itemIndex); if (pGroupItem) { pGroupItem->Remove(); } ++itemIndex; } pGroup->Remove(); } ++groupIndex; } } the code above does not delete all the elements, but just some of them. the following code just breaks back into debuger CXTPTaskPanelItem* pItem = pItems->GetAt(0); CPtrList ls; while (pItem) { ls.AddTail((LPVOID)pItem); pItem = m_wndTaskPanel.GetNextItem(pItem, 1, TRUE); } if (!ls.IsEmpty()) { POSITION pos = ls.GetHeadPosition(); for ( ;pos!= NULL; ) { CXTPTaskPanelItem* pItem = reinterpret_cast<CXTPTaskPanelItem*>(ls.GetNext(pos)); if (pItem) { pItem->Remove(); } } } |
|
![]() |
|
Oleg
Senior Member
Joined: 21 May 2003 Location: United States Status: Offline Points: 11234 |
Post Options
Thanks(0)
Quote Reply
Posted: 04 November 2005 at 12:12am |
|
All you need is: m_wndTaskPanel.SetHotItem(NULL); m_wndTaskPanel.SetFocusedItem(NULL); m_wndTaskPanel.GetGroups().Clear(); |
|
|
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS |
|
![]() |
|
Russ
Groupie
Joined: 21 September 2003 Location: Russian Federation Status: Offline Points: 28 |
Post Options
Thanks(0)
Quote Reply
Posted: 04 November 2005 at 12:23am |
|
great! thank you Oleg.
|
|
![]() |
|
Post Reply
|
|
|
Tweet
|
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |