Print Page | Close Window

CListCtrl / CTreeCtrl in CXTPTaskPanel ???

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=4419
Printed Date: 10 November 2025 at 5:53pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CListCtrl / CTreeCtrl in CXTPTaskPanel ???
Posted By: mpmooreblvu
Subject: CListCtrl / CTreeCtrl in CXTPTaskPanel ???
Date Posted: 15 June 2006 at 5:28pm
I am trying to put CListView and CTreeView controls into a CXTPTaskPanel. Each list or tree control will be the only item in a group.

My problem is that I would like the tree and list controls to resize to use all of the available space when their group is active. This seems hard.

Can anyone point to sample code which does this?

The CXTPTaskPanel will also be resizeable.


thank you;
Matthew P Moore





Replies:
Posted By: hipopotamo
Date Posted: 20 June 2006 at 2:20pm
Hi,
 
 I do not know if the lastest updates have this "fixed" or not, but in the 9.80 I had do to this...
 
I'm not sure if it's 100% correct...
 
void CMyTaskPanel::UpdateScrollBar()
{
 
 if ( !IsExplorerBehaviour() )
 {
  
  int nClientHeight = CXTPClientRect(this).Height();
  
  if ( nClientHeight > 0 )
  {

   bool bDefault;
   bDefault = false;

   for ( int i = 0; ( i < GetGroups()->GetCount() ) && !bDefault; ++i )
   {
    
    CXTPTaskPanelGroup* pGroup = GetAt(i);

    if ( pGroup->IsExpanding() ) continue;
    
    CRect rcGroup = pGroup->GetTargetClientRect();
    
    for ( int j = 0; ( j < pGroup->GetItemCount() ) && !bDefault; ++j )
    {
     
     CXTPTaskPanelGroupItem *pItem = (CXTPTaskPanelGroupItem*)pGroup->GetAt(j);
     
     if ( !pItem || pItem->GetType() != xtpTaskItemTypeControl )
     {
      
      bDefault = true;
      
      break;
     }
     
     int nItemHeight = rcGroup.Height() - 2;
     
     if ( pItem->GetItemRect().Height() != nItemHeight )
     {
     
      
      ::SetWindowPos( pItem->m_hWnd, 0, pItem->GetItemRect().left,  pItem->GetItemRect().left, pItem->GetItemRect().Width(), nItemHeight, SWP_NOZORDER );

      if ( !pGroup->IsExpanding() )

       pItem->SetSize(CSize(0, nItemHeight), false );
      
     }
    }  
    
   }
  }

 }

 
   
    //   
    
 CXTPTaskPanel::UpdateScrollBar();

 

   
} // UpdateScrollBar



Posted By: mpmooreblvu
Date Posted: 20 June 2006 at 2:26pm
Thank you for your reply. It is no longer an issue for me for two reasons:
1) my boss decided he wants different behavior
2) Oleg Chernyahovskii of codejock.com mailed me a much simpler answer:
 

Solution: -------------------------------------------

Hi,

just call

pItem->SetSize (CSize(x, 0), TRUE);

method declaration:

void SetSize(CSize szItem, BOOL bAutoHeight = FALSE);

-----------------------------------------
 
This gives the behavior I wanted - the CListView / CTreeView item automatically sizes to use the full vertical height available to the group. Unfortunately it doesn't size to take advantage of the full horizontal width available, but if I use CSize( 2000, 0 ) then the controls are wide enough for any practical CXTPTaskPanel, and they grow horizontal scroll bars when needed and behave sensibly.
 
Thank you;
Matthew P Moore
 



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