Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Hiding the tabs in CExtTabMdiWnd Collapse All
Subject Author Date
Bob Sabiston Aug 30, 2005 - 6:40 PM

Hi:


I’d like to have the cabability of showing / hiding the mdi tab bar when using a CExtTabMdiWnd.  The tab bar would be hidden in two cases:


 1)  Only one document is open.  In this case, it would look like an SDI application.


 2)  In full screen mode.


One possibility that would work would be similar to the CManagedTabPageContainer in the TabPages example.  I could override the OnFlatTabWndGetSize function to return 0 when I want to hide the tabs. 


There are twp problems with this:


 -  I don’t have the flexibility of using other styles of windows like CExtTabMdiOneNoteWnd (for example)


-   It just seems liike this should be easier!


 


Thanks,


Bob Sabiston


 

Technical Support Aug 31, 2005 - 7:04 AM

The visibility of the mdi tab window is managed automatically by the CExtTabMdiWnd::OnTabWndSyncVisibility virtual method. So, just override this method in a CExtTabMdiWnd-derived class like as follows:

class CMyExtTabMdiWnd : public CExtTabMdiOneNoteWnd 
{
public:
    CMyExtTabMdiWnd() 
        : CExtTabMdiOneNoteWnd()
        , m_bVisible( true )
    {
    }
    void SetVisibility(bool bVisible=true)
    {
        m_bVisible = bVisible;
    } 
    bool GetVisibility()
    {
        return m_bVisible;
    } 
protected:    
    bool m_bVisible;
    virtual void OnTabWndSyncVisibility ()
    {
        ShowWindow( 
            m_bVisible && ItemGetCount() > 0
                ? SW_SHOW 
                : SW_HIDE 
                );
    }
}; // class CMyExtTabMdiWnd
After calling the CMyExtTabMdiWnd::SetVisibility method, do not forget to call the RecalcLayout method of the frame window.