Click here to Skip to main content
Click here to Skip to main content
Go to top

A simple tabbed MDI for WTL

, 22 Dec 2001
Rate this:
Please Sign up or sign in to vote.
Add a simple tab control that shows the opened child windows in an MDI application

Sample Image - wtlmditab.gif

Introduction

This class adds a simple tab control in a WTL based MDI application. It is partly based on the freeware MFC version from Dundas Software available at

Usage

First include the header file and create a CMDITabImpl member in the main frame class.

#include <span class="code-string">"atlmditab.h"
</span>

...
class CMainFrame : public ....
{
    CMDITabImpl<CMainFrame> m_TabbedMDI;

Then attach to the control in main frame's OnCreate(..) function

LRESULT OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, 
    LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
    ....
    CreateMDIClient();
    m_CmdBar.SetMDIClient(m_hWndMDIClient);
    m_TabbedMDI.Attach(this);
    ...
}

Then you must add an UpdateLayout() function in main frame to place the tab control correctly. If anybody finds a solution for WTL that won't require this extra code, please let me know.

void UpdateLayout(BOOL bResizeBars = TRUE)
{
    RECT rect;
    GetClientRect(&rect);
    
    // position bars and offset their dimensions
    UpdateBarsPosition(rect, bResizeBars);
        
    m_TabbedMDI.UpdateTabLayout(m_hWndClient, rect);
}

Limitations

This class is written for learning WTL, so there are surely lots of bugs in the implementation. And some features are not implemented yet, like icon support and context menu. I will work on them later when I get more time. Cheers.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

David Y. Zhao
Web Developer
Sweden Sweden
No Biography provided

Comments and Discussions

 
Questionm_wndMDIClient PinmemberXiaoK Lin15-Apr-12 4:10 
GeneralFails to build PinsussAnonymous29-Oct-02 4:09 
GeneralRe: Fails to build PinmemberYan.K22-Sep-04 15:07 
GeneralVery nice, but... PinmemberGavin Jerman11-Apr-02 4:37 

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

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

| Advertise | Privacy | Mobile
Web02 | 2.8.140921.1 | Last Updated 23 Dec 2001
Article Copyright 2001 by David Y. Zhao
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid