5,448,104 members and growing! (15,205 online)
Email Password   helpLost your password?
Desktop Development » Document / View » General     Intermediate

A multi document tabbed interface

By Dundas Software

A variation on the MDI that indicates the open child windows in a tab control.
VC6, C++Windows, NT4, MFC, VS6, Visual Studio, Dev

Posted: 29 Jan 2000
Updated: 29 Jan 2000
Views: 130,388
Bookmarked: 49 times
Announcements
Want a new Job?



Search    
Advanced Search
Sitemap
32 votes for this Article.
Popularity: 6.48 Rating: 4.30 out of 5
1 vote, 10.0%
1
0 votes, 0.0%
2
1 vote, 10.0%
3
1 vote, 10.0%
4
7 votes, 70.0%
5
  • Download demo project - 30 Kb
  • Download source files - 11 Kb
  • Download self-extracting installer - 363 Kb

    Sample Image - TabbedMDI.gif

    We have introduced a new interface extension for MDI (multiple document interface) based applications - MDI tabbed interface or MTI. This class is part of the Ultimate Toolbox class library and can be used freely.

    We haven't changed anything in the relationships between the main frame window (MDIFrame window) and its children (MDIChild windows). We added functionality that is usually overlooked when developing MDI applications.

    The MDIClient window which resides in the client area of the MDIFrame window manages MDIChild windows. Instead of just displaying the MDIClient window we also display a standard tab control (hence tabbed MDI) in which we create an item for every MDIChild window. The window icon and text will be associated with the corresponding tab item.

    Using the tab control you can switch quickly between MDIChild windows by just clicking on the tab item. If you double click over a tab item, the corresponding MDIChild window will be maximized/restored. And, finally, when any object is dragged over the tab control items (using standard OLE drag and drop) the corresponding MDIChild window will be activated.

    We use a standard tab control so you can customize its appearance using the standard set of relevant functions (refer for CTabCtrl description in the MFC documentation).

    We developed three classes in order to provide the above described functionality:

    COXTabWorkspaceDropTarget COleDropTarget derived class used to support the changing of active MDIChild when any object is dragged over tab control items (This is an internal class)
    COXTabWorkspace CTabCtrl derived class. Covers MDIClient area. For every MDIChild window there will be the tab item that will use window text and icon as item text and icon. Whenever you click on the item the coresponding child window will be activated. Whenever you double click on the item the corresponding MDIChild window will be maximized/restored
    COXTabClientWnd CWnd derived class. Subclasses MDIClient window. Manages the placement of the MDIClient and tab control regarding each other.

    Almost all the logic of the classes is implemented internally and there are few public members. Refer to COXTabWorkspace reference for the list of  functions available to customize the tab control appearance.

    COXTabClientWnd class has a few public functions (refer to COXTabClientWnd reference for details) but primarily you will be interested in the following ones:

    Attach()

    Detach()

    Below you two steps that should be taken in order to implement tabbed MDI interface in your MDI application

    1. In your CMainFrame class declare variable of COXTabClientWnd class:
      COXTabClientWnd m_MTIClientWnd;
              
    2. In your CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) function implementation add the following line of code:
      m_MTIClientWnd.Attach(this);

    That's it.

    Sample

    The TabbedMDI project included in the samples directory shows the class in action. There you will see how you can customize the tabbed MDI interface appearance.


    COXTabWorkspace

    SetOffset

    Sets the margin between tab control and MDIFrame client area borders

    GetOffset

    Retrieves the margin between tab control and MDIFrame client area borders

    AcceptDraggedObject

    Sets/Removes dragging object over support for the tab control

    IsAcceptingDraggedObject

    Retrieves the flag that specifies whether the control activate the corresponding MDIChild window when an object is dragged over tab control items.

    void SetOffset(const DWORD dwOffset)

    Parameters

    dwOffset

    offset in points from the MDIFrame window client area where the tab control will be displayed

    Remarks

    Sets the tab control offset from MDIFrame client area borders

    DWORD GetOffset() const

    Return Value

    offset in points from the MDIFrame window client area where the tab control will be displayed

    Remarks

    Retrievs the tab control offset from MDIFrame borders

    void AcceptDraggedObject(const BOOL bAccept=TRUE)

    Parameters

    bAccept if TRUE then when any object is dragged over tab items the corresponding MDIChild windows will be activated

    Remarks

    Set/Remove drag over object support for the tab control

    BOOL IsAcceptingDraggedObject() const

    Parameters

    bAccept

    if TRUE then when any object is dragged over tab items the corresponding MDIChild windows will be activated

    Return Value

    TRUE if when any object is dragged over tab items the corresponding MDIChild windows will be activated


    COXTabClientWnd

    Attach

    Substitutes the standard MDI interface with tabbed MDI

    Detach

    Restores the standard MDI interface

    IsAttached

    Retrieves the flag that specifies whether the standard MDI interface was substituted with enhanced tabbed MDI or not.

    GetTabCtrl

    Gets the fellow tab control

    GetParentFrame

    Gets the parent MDIFrame

    BOOL Attach(const CMDIFrameWnd* pParentFrame, DWORD dwTabCtrlStyle=DEFAULT_TABCTRLSTYLE)

    Parameters

    pParentFrame pointer to MDIFrame window of  the application
    dwTabCtrlStyle tab control styles that will be used while creating the tab control. Refer to the Windows SDK documentation for list of all available styles. The following styles are used by default:
    TCS_MULTILINE
    TCS_BOTTOM
    TCS_HOTTRACK
    TCS_SCROLLOPPOSITE
    TCS_RIGHTJUSTIFY

    Return Value

    TRUE if success or FALSE otherwise.

    Remarks

    Substitutes the standard MDI interface with enhanced tabbed MDI

    BOOL Detach()

    Return Value

    TRUE if successful or FALSE otherwise.

    Remarks

    Restore the standard MDI interface

    BOOL IsAttached() const

    Return Value

    TRUE if the tabbed MDI interface is active.

    Remarks

    Retrieves the flag that specifies whether the standard MDI interface was substituted with enhanced tabbed MDI or not.

    COXTabWorkspace* GetTabCtrl()

    Return Value

    pointer to the tab control

    Remarks

    Retrieves pointer to the tab control

    CMDIFrameWnd* GetParentFrame()

    Return Value

    pointer to the parent MDIFrame window or NULL if none was attached

    Remarks

    Retrieves pointer to the parent MDIFrame window

  • 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

    About the Author

    Dundas Software


    Since 1992, Dundas Software has been helping companies across the world with our state of the art Software Development Components and Custom Development Solutions. Our products have a global reputation of being of the highest quality, and are all designed, built and tested to meet the strictest requirements that corporate software developers demand.

    For the last 7 years, Dundas Software has been a leading firm in the development of advanced Charting, Diagramming and Data Visualization solutions. Our thoughts in the design and development of Dundas products are to help developers save time and money with elegant, well thought out, productivity enhancing components. This is reflected in our numerous awards and rapid adoption of Dundas Technologies by Fortune 500 companies across the globe.

    The quality of our products in conjunction with our unmatched technical support, numerous awards and years of experience reflect Dundas Software's commitment to being the best.
    Location: United States United States

    Other popular Document / View articles:

    Article Top
    Sign Up to vote for this article
    You must Sign In to use this message board.
    FAQ FAQ Noise ToleranceSearch Search Messages 
     Layout  Per page   
     Msgs 1 to 25 of 32 (Total in Forum: 32) (Refresh)FirstPrevNext
    Subject  Author Date 
    GeneralExcellent, slight fix thoughmemberJohn-Lucas Brown0:26 6 Jul '07  
    GeneralTab control redraw problemmemberatali12:27 6 Oct '04  
    Generalhow to add open documents as childs of Tree items??membermahatma_cis4:54 5 Aug '04  
    GeneralHelp Mememberasv9:39 9 Jun '04  
    GeneralProgramatically Switching Child Views in Tabbed MDImemberspeakeasy5:58 11 May '04  
    GeneralTabbedMDI Demo BUG on XPmemberAmit Gefen21:05 8 Feb '04  
    GeneralRe: TabbedMDI Demo BUG on XPmemberIvor S. Sargoytchev5:25 9 Feb '04  
    GeneralRe: TabbedMDI Demo BUG on XPmemberAmit Gefen5:22 10 Feb '04  
    GeneralRe: TabbedMDI Demo BUG on XPmemberIvor S. Sargoytchev5:35 10 Feb '04  
    GeneralRe: TabbedMDI Demo BUG on XPmembers0ck21:31 21 Mar '04  
    GeneralRe: TabbedMDI Demo BUG on XPmemberAmit Gefen22:41 25 Jun '04  
    GeneralRe: TabbedMDI Demo BUG on XPmemberAmit Gefen22:41 25 Jun '04  
    GeneralBug reportmemberDarkgan9:26 16 Jan '04  
    GeneralRe: Bug reportmemberIvor S. Sargoytchev9:45 16 Jan '04  
    GeneralRe: Flicker!!!memberIvor S. Sargoytchev4:47 16 Jan '04  
    Generalso slow.....memberminsung Chun21:08 30 Mar '03  
    GeneralRe: so slow.....memberIvor S. Sargoytchev4:45 16 Jan '04  
    GeneralOpen files get overwrittenmemberbrianwelsch4:52 9 Oct '02  
    GeneralTrying to Open Doc in new tabmemberbrianwelsch10:33 12 Sep '02  
    GeneralFreaking 3D client borders...memberDarren Schroeder5:57 21 Jul '02  
    GeneralTabs in Child Window?memberUdupa23:06 2 Jul '02  
    GeneralRe: Tabs in Child Window?memberPeter Zajac11:17 3 Jul '02  
    GeneralRe: Tabs in Child Window?memberUdupa20:03 3 Jul '02  
    GeneralRe: Tabs in Child Window?memberPeter Zajac4:35 4 Jul '02  
    GeneralMemory Leak...memberAnonymous23:24 12 Jun '02  

    General General    News News    Question Question    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

    PermaLink | Privacy | Terms of Use
    Last Updated: 29 Jan 2000
    Editor: Chris Maunder
    Copyright 2000 by Dundas Software
    Everything else Copyright © CodeProject, 1999-2008
    Web11 | Advertise on the Code Project