Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CListCtrl / CTreeCtrl in CXTPTaskPanel ???
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CListCtrl / CTreeCtrl in CXTPTaskPanel ???

 Post Reply Post Reply
Author
Message
mpmooreblvu View Drop Down
Newbie
Newbie


Joined: 15 June 2006
Location: United States
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote mpmooreblvu Quote  Post ReplyReply Direct Link To This Post Topic: CListCtrl / CTreeCtrl in CXTPTaskPanel ???
    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


Back to Top
hipopotamo View Drop Down
Groupie
Groupie


Joined: 01 June 2006
Location: Portugal
Status: Offline
Points: 34
Post Options Post Options   Thanks (0) Thanks(0)   Quote hipopotamo Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
mpmooreblvu View Drop Down
Newbie
Newbie


Joined: 15 June 2006
Location: United States
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote mpmooreblvu Quote  Post ReplyReply Direct Link To This Post 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
 
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.