Click here to Skip to main content
16,005,169 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: standard Include Directories in Vc++ VS2005 Pin
fefe.wyx10-Oct-06 22:36
fefe.wyx10-Oct-06 22:36 
QuestionSplitter windows within CTabCtrl Pin
joshiprashant10-Oct-06 20:31
joshiprashant10-Oct-06 20:31 
AnswerRe: Splitter windows within CTabCtrl Pin
Mark Salsbery10-Oct-06 20:47
Mark Salsbery10-Oct-06 20:47 
GeneralRe: Splitter windows within CTabCtrl Pin
joshiprashant10-Oct-06 20:49
joshiprashant10-Oct-06 20:49 
GeneralRe: Splitter windows within CTabCtrl Pin
Mark Salsbery10-Oct-06 20:53
Mark Salsbery10-Oct-06 20:53 
GeneralRe: Splitter windows within CTabCtrl Pin
joshiprashant10-Oct-06 21:03
joshiprashant10-Oct-06 21:03 
GeneralRe: Splitter windows within CTabCtrl Pin
uday kiran janaswamy10-Oct-06 22:45
uday kiran janaswamy10-Oct-06 22:45 
GeneralRe: Splitter windows within CTabCtrl Pin
Mark Salsbery11-Oct-06 7:46
Mark Salsbery11-Oct-06 7:46 
You're on the right track.

I personally use a CTabCtrl as just a control and handle everything in the control's parent (like
you would a simple control like a button in a dialog.
The parent window class (CView-derived in your case) contains:
1) a CTabCtrl object
2) an array of CWnd pointers for each tab's window.
The parent window (I'll call it CTabCtrlParent handles window resizing and tab control
notifications.
In CTabCtrlParent OnCreate() I create the tab control, create each window for each tab, placing
the (window pointers in the array for easy indexing later) and using CTabCtrl::InsertItem() to
add a tab using the same index as the window pointer array index.
In CTabCtrlParent OnNotify() I handle TCN_SELCHANGE, TCN_SELCHANGING notifications from the tab
control. For TCN_SELCHANGE I hide the current tab window, show the new tab window (using
MoveWindow() or something to size it in the tab control.
In CTabCtrlParent::OnSize() I resize the tab control to fit the client area and resize the current
tab window to fit the tab control's "client" area. This is the most complicated part so here's
an example:

if (pTabControl && (pTabControl->m_hWnd != 0))
{
    CRect CliRect;
    // Track the tab control's "client" area and reposition current tab window
    pTabControl->GetWindowRect(&CliRect);
    ::MapWindowPoints(0, *pTabControl, (LPPOINT)&CliRect, 2);

    // Get the tab control's "client rect", the drawable area of the control.
    CRect TabClientRect = CliRect;
    pTabControl->AdjustRect(false, &TabClientRect);

    ::MapWindowPoints(*pTabControl, *this, (LPPOINT)&TabClientRect, 2);

    // Move/resize the tab window AND the current tab "client" window.  Make
    //    sure "client" window is always drawn on TOP of the tab control.
    int i = pTabControl->GetCurSel();
    if (i >= 0 && TabWindowPointerArray[i] && TabWindowPointerArray[i]->m_hWnd)
    {
        HDWP hDwp;
        if ((hDwp = ::BeginDeferWindowPos(2)) != 0)
        {
            hDwp = ::DeferWindowPos(hDwp,*pTabControl,0,0,0,
                        CliRect.Width(),CliRect.Height(),
                            SWP_NOMOVE | SWP_NOZORDER);
            hDwp = ::DeferWindowPos(hDwp,*TabWindowPointerArray[i], HWND_TOP,
                        TabClientRect.left,TabClientRect.top,
                    TabClientRect.Width(),TabClientRect.Height(), 0);
            ::EndDeferWindowPos(hDwp);
        }
    }
}


This takes care of your tab controll stuff. In the tab windows is where you'll have a splitter
and more windows, one for each splitter pane. Now you see why it's a lot of code to show here as
an example Smile | :)
Questioncreate a CPtrArray Pin
SaptaSri10-Oct-06 20:27
SaptaSri10-Oct-06 20:27 
AnswerRe: create a CPtrArray Pin
Mark Salsbery10-Oct-06 20:51
Mark Salsbery10-Oct-06 20:51 
GeneralRe: create a CPtrArray Pin
Aqueel11-Oct-06 1:07
Aqueel11-Oct-06 1:07 
AnswerRe: create a CPtrArray Pin
Hamid_RT12-Oct-06 6:56
Hamid_RT12-Oct-06 6:56 
QuestionHELP....>!!!!! Pin
SaptaSri10-Oct-06 20:24
SaptaSri10-Oct-06 20:24 
AnswerRe: HELP....>!!!!! Pin
Cedric Moonen10-Oct-06 21:38
Cedric Moonen10-Oct-06 21:38 
AnswerRe: HELP....>!!!!! Pin
Aqueel10-Oct-06 22:14
Aqueel10-Oct-06 22:14 
GeneralRe: HELP....>!!!!! Pin
benjymous10-Oct-06 23:03
benjymous10-Oct-06 23:03 
AnswerRe: HELP....>!!!!! Pin
<color>Aljechin 11-Oct-06 2:00
<color>Aljechin 11-Oct-06 2:00 
Questioncreateprocess without set path of exe Pin
samira forooghi10-Oct-06 20:04
samira forooghi10-Oct-06 20:04 
AnswerRe: createprocess without set path of exe Pin
Hamid_RT10-Oct-06 20:15
Hamid_RT10-Oct-06 20:15 
GeneralRe: createprocess without set path of exe Pin
David Crow11-Oct-06 8:08
David Crow11-Oct-06 8:08 
GeneralRe: createprocess without set path of exe Pin
Hamid_RT11-Oct-06 9:15
Hamid_RT11-Oct-06 9:15 
AnswerRe: createprocess without set path of exe Pin
Michael Dunn10-Oct-06 20:29
sitebuilderMichael Dunn10-Oct-06 20:29 
GeneralRe: createprocess without set path of exe Pin
Hamid_RT10-Oct-06 20:43
Hamid_RT10-Oct-06 20:43 
GeneralRe: createprocess without set path of exe [modified] Pin
samira forooghi10-Oct-06 20:58
samira forooghi10-Oct-06 20:58 
GeneralRe: createprocess without set path of exe Pin
Hamid_RT10-Oct-06 21:02
Hamid_RT10-Oct-06 21:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.