Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Removing contnets of TaskPanel
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Removing contnets of TaskPanel

 Post Reply Post Reply
Author
Message
Russ View Drop Down
Groupie
Groupie
Avatar

Joined: 21 September 2003
Location: Russian Federation
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote Russ Quote  Post ReplyReply Direct Link To This Post Topic: Removing contnets of TaskPanel
    Posted: 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();
                }
           }     
     }
Back to Top
Oleg View Drop Down
Senior Member
Senior Member


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Russ View Drop Down
Groupie
Groupie
Avatar

Joined: 21 September 2003
Location: Russian Federation
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote Russ Quote  Post ReplyReply Direct Link To This Post Posted: 04 November 2005 at 12:23am
great! thank you Oleg.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.047 seconds.