Solved

Get CTabCtrl client size within a splitter window

Posted on 2003-11-24
3
672 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Generic progress indicator 6 113
Complete beginner needs help making a cron job 9 110
has77  challenge 9 73
modThree challenge 4 80
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
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 Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

863 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

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now