Solved

Get CTabCtrl client size within a splitter window

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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
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 video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

760 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

21 Experts available now in Live!

Get 1:1 Help Now