Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Task Panel
  New Posts New Posts RSS Feed - Nested CXTPTaskPanelGroup
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Nested CXTPTaskPanelGroup

 Post Reply Post Reply
Author
Message
fbeaupre View Drop Down
Newbie
Newbie
Avatar

Joined: 22 May 2006
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote fbeaupre Quote  Post ReplyReply Direct Link To This Post Topic: Nested CXTPTaskPanelGroup
    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.
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 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
Back to Top
Simon HB9DRV View Drop Down
Senior Member
Senior Member
Avatar

Joined: 07 July 2005
Location: Switzerland
Status: Offline
Points: 458
Post Options Post Options   Thanks (0) Thanks(0)   Quote Simon HB9DRV Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


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: 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
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.141 seconds.