Solved

Get CTabCtrl client size within a splitter window

Posted on 2003-11-24
3
673 Views
Last Modified: 2013-11-20
I derive a subclass A from CTabCtrl and put A into a CView-derived class B. B is used as a view in the splitter window. The splitter window has one row and two columns. I want to put a CWnd-derived class into pane (0, 0).

The code is like this:

class A : public CTabCtrl { ... };

class B : public CView
{
public:
    A m_a;
...
};

class D : public CWnd
{
    CTreeCtrl m_treeCtrl;
};

BOOL B::Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, UINT nID, CCreateContext* pContext)
{
      // TODO: Add your specialized code here and/or call the base class
      if(!CView::Create(lpszClassName, lpszWindowName, dwStyle, rect, pParentWnd, nID, pContext))
            return false;
                /* here the rect has much smaller size than pane (0, 0) */

      CRect rectTmp;
      GetParent()->GetClientRect(&rectTmp);
      m_a.Create(WS_CHILD | WS_VISIBLE | TCS_OWNERDRAWFIXED, rectTmp,
                         this, IDC_TABA);
                /* Here rectTmp is just 0 for top, bottom, left, right */
      D *pD = new D;
      pD->Create(NULL, "MyContainer", WS_CHILD | WS_VISIBLE, rectTmp,
            &m_a, IDC_DDD);
      pD->GetClientRect(&rectTmp);
      m_treeCtrl.Create(WS_CHILD | WS_VISIBLE |
                                 TVS_HASLINES | TVS_LINESATROOT |
                                 TVS_HASBUTTONS | TVS_SHOWSELALWAYS,
                                 rectTmp,
                                 pD,
                                 IDC_LEFTTABTREECTRL);

                TC_ITEM tcItem;
                tcItem.mask = TCIF_TEXT | TCIF_PARAM;
                tcItem.pszText = "Browser";
                tcItem.param = (LPARAM) pD;
      m_a.InsertItem(pD, "Browser");
                return true;
}

So how can I get the correct size for child window D so that D will occupies all the empty area in the TabCtrl?

Thanks for your help
0
Comment
Question by:htang_us
3 Comments
 
LVL 2

Author Comment

by:htang_us
ID: 9818404
I have solved this question.

In class B, WM_SIZE is processed and pass the coordinates to Tab Ctrl and TreeCtrl, so that they can correctly resize themselves.

0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
ID: 9838336
PAQed, with points refunded (50)

Computer101
E-E Admin
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
cat dog challenge 18 124
conditional code and condition difference 9 82
Hibernate methods 2 71
lucky13 challenge 11 142
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This tutorial gives a high-level tour of the interface of Marketo (a marketing automation tool to help businesses track and engage prospective customers and drive them to purchase). You will see the main areas including Marketing Activities, Design …

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question