Print Page | Close Window

Nested CXTPTaskPanelGroup

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Task Panel
Forum Description: Topics Related to Codejock Task Panel
URL: http://forum.codejock.com/forum_posts.asp?TID=4258
Printed Date: 04 May 2024 at 11:28am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Nested CXTPTaskPanelGroup
Posted By: fbeaupre
Subject: Nested CXTPTaskPanelGroup
Date Posted: 22 May 2006 at 10:26am

Hi,

I would like to have the possibility to put a CXTPTaskPanelGroup inside of a CXTPTaskPanelGroupItems class. Since CXTPTaskPanelGroup is a child of CXTPTaskPanelItem, this should be pretty straightforward. In doing so, I could have multiple levels of nested groups inside my task panels (kink of like in a treeview). Here is the code I used to nest my groups (modified version of toolbox sample) (I force the call to ResetToolboxItems at every program startup):

void CMainFrame::ResetToolboxItems()
{
 m_wndTaskPanel.GetGroups()->Clear(FALSE);

 CXTPTaskPanelGroup* pFolderData = CreateToolboxGroup(ID_TOOLBOXFOLDER_DATA);
 pFolderData->AddLinkItem(ID_TOOLBOXITEM_DATASET&nbs p;         &nbs p;      ,26);
 pFolderData->AddLinkItem(ID_TOOLBOXITEM_OLEDBDATAAD APTER        ,27);
 pFolderData->AddLinkItem(ID_TOOLBOXITEM_OLEDBCONNEC TION         ,28);
 pFolderData->AddLinkItem(ID_TOOLBOXITEM_OLEDBCOMMAN D           ;  ,29);
 pFolderData->AddLinkItem(ID_TOOLBOXITEM_SQLDATAADAP TER          ,30);
 pFolderData->AddLinkItem(ID_TOOLBOXITEM_SQLCONNECTI ON         &nbs p; ,31);
 pFolderData->AddLinkItem(ID_TOOLBOXITEM_SQLCOMMAND& nbsp;         & nbsp;   ,32);
 pFolderData->AddLinkItem(ID_TOOLBOXITEM_DATAVIEW&nb sp;         &nb sp;     ,33);

    {
        CXTPTaskPanelGroup* pFolderGeneral = new CXTPTaskPanelGroup(&m_wndTaskPanel);
        CXTPTaskPanelGroupItem* pPointer = pFolderGeneral->AddLinkItem(ID_TOOLBOXITEM_POINTER, 0);
        pPointer->SetItemSelected(TRUE);
        pPointer->AllowDrag(FALSE);
        pPointer->AllowDrop(FALSE);
        pFolderGeneral->SetIconIndex(IDR_MAINFRAME);
        pFolderGeneral->SetCaption( L"BOB" );
        pFolderData->GetItems()->Add( pFolderGeneral, ID_TOOLBOXFOLDER_GENERAL );
    }

 pFolderData->SetExpanded(TRUE);
}

With the above code, everything compiles (all I do is legal according to the class hierarchy and the documentation). The problem occurs at runtime. I get a crash in this function:


void CXTPTaskPanelPaintManager::DrawGroupClientItems(CDC* pDC, CXTPTaskPanelGroup* pGroup, CRect rc)
{
 int nOffset = rc.top - pGroup->GetScrollOffsetPos();

 for (int i = pGroup->GetOffsetItem(); i < pGroup->GetItemCount(); i++)
 {
  CXTPTaskPanelGroupItem* pItem = pGroup->GetAt(i);
  if (!pItem->IsVisible())
   continue;

  CRect rcItem = pItem->GetItemRect();
  rcItem.OffsetRect(0, nOffset);

  pItem->OnDrawItem(pDC, rcItem);
 }
}

The problem comes from the GetAt function which does a c static cast on the returned pointer assuming that the base class pointer is of a certain derived type (which is a bug or a lack of documentation, in my opinion) Here is the code of GetAt:

CXTPTaskPanelGroupItem* CXTPTaskPanelGroup::GetAt(int nIndex) const
{
 return (CXTPTaskPanelGroupItem*)m_pItems->GetAt(nIndex);
}

I would really appreciate if someone at codejock could tell me if you are going to support nested CXTPTaskPanelGroup in a short period of time. We would need such a feature as soon as it would be available.



-------------
Frédérick Beaupré
Software Developper
InnovMetric Software Inc.



Replies:
Posted By: Oleg
Date Posted: 22 May 2006 at 2:36pm

Hello,

It can't work.... You can only create another TaskPanel and insert it as control.

 

use Search...  I posted some sample time ago..

 



-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: Simon HB9DRV
Date Posted: 17 August 2006 at 1:12pm
Originally posted by oleg oleg wrote:

Hello,

It can't work.... You can only create another TaskPanel and insert it as control.

 

use Search...  I posted some sample time ago..

 


Is it possible to put a CListCtrl inside a panel / group? I guess not - the ShortcutBar is what I want anyway!


-------------
Simon HB9DRV


Posted By: Oleg
Date Posted: 17 August 2006 at 1:40pm
You can :)
in TakPanel sample see  Search dialog.
 
CXTPTaskPanelGroupItem* pItem = pGroup->AddControlItem(m_dlgModified);


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS



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