Print Page | Close Window

Removing contnets of TaskPanel

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=3137
Printed Date: 09 November 2025 at 7:34am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Removing contnets of TaskPanel
Posted By: Russ
Subject: Removing contnets of TaskPanel
Date 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();
                }
           }     
     }



Replies:
Posted By: Oleg
Date 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


Posted By: Russ
Date Posted: 04 November 2005 at 12:23am
great! thank you Oleg.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net