Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Get CTabCtrl client size within a splitter window

Posted on 2003-11-24
3
Medium Priority
?
689 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

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…
Ready to get certified? Check out some courses that help you prepare for third-party exams.
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 course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
Suggested Courses

722 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