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 » hide panel when only one single tabbed document Collapse All
Subject Author Date
Chun Pong Lau Oct 1, 2006 - 7:46 AM

Hello dear support team,

When I have only 1 single tabbed document (__EDBS_DOCUMENT), can I hide the panel with the 1 tab and also the left and right and close button above the document (the same behaviour with FireFox) for simplicity?

Thanks in advance,
Alan

Technical Support Oct 2, 2006 - 11:04 AM

The solution to what you are looking for is as follows.

1. Create a CExtMenuControlBar-derived class and override its CExtMenuControlBar::IsDisplayDocumentButtons() virtual method. Leave this method empty but simply return false in it.

2. Create a CExtTabMdiWnd-derived class and implement the following virtual method in it:

    virtual void OnTabWndSyncVisibility()
    {
        LONG nItemCount = ItemGetCount();
        DWORD dwWndStyle = GetStyle();
        if(      nItemCount > 1
            &&   (!(   CExtControlBar::FindPrintPreviewMode(
                            STATIC_DOWNCAST( CFrameWnd, GetParent() )
                            )
                    || CExtControlBar::IsOleIpObjActive(
                            STATIC_DOWNCAST( CFrameWnd, GetParent() )
                            )
                 ) )
            )
        {
            if( (dwWndStyle & WS_VISIBLE) == 0 )
            {
                ::SetWindowPos(
                    m_hWnd,
                    NULL, 0, 0, 0, 0,
                    SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
                        |SWP_FRAMECHANGED
                        |SWP_SHOWWINDOW
                    );
                HWND hWndMdiArea = _GetHwndMdiArea();
                if( hWndMdiArea != NULL )
                    ::SetWindowPos(
                        hWndMdiArea,
                        NULL, 0, 0, 0, 0,
                        SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
                            |SWP_FRAMECHANGED
                        );
            }
        }
        else
        {
            if( (dwWndStyle & WS_VISIBLE) != 0 )
                ::SetWindowPos(
                    m_hWnd,
                    NULL, 0, 0, 0, 0,
                    SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
                        |SWP_NOSENDCHANGING
                        |SWP_HIDEWINDOW
                    );
        }
        dwWndStyle = GetStyle();
        if( (dwWndStyle & WS_VISIBLE) == 0 )
            m_nIndexVisFirst = m_nIndexVisLast = -1;
    }

Chun Pong Lau Oct 2, 2006 - 7:49 PM

Dear support team,

1. It seems that there is only CExtMenuControlBar::IsDisplayMdiDocumentButtons() but no CExtMenuControlBar::IsDisplayDocumentButtons().

2. I have made CExtMenuControlBar::IsDisplayMdiDocumentButtons() returning false and implemented the given CExtTabMdiWnd::OnTabWndSyncVisibility() but it seems this function is never executed even the tab selection panel is appeared on the UI.

3. I am using SDI. Does it matter?

Regards,
Alan

Technical Support Oct 3, 2006 - 2:40 AM

We provided the solution only for MDI projects. SDI projects with dynamic control bars are based on the CExtTabPageContainerWnd window as the main view window. This window contains one CExtTabWnd control and a set of page windows. So, you need to implement both CExtTabWnd-derived and CExtTabPageContainerWnd-derived classes. The latter should be used in your project.

class CYourTabWnd : public CExtTWPC < CExtTabWnd >
{
public:
    void OnTabWndSyncVisibility()
    {
        LONG nItemCount = _BT::ItemGetCount();
        DWORD dwWndStyle = GetStyle();
        if( nItemCount > 1 )
        {
            if( (dwWndStyle & WS_VISIBLE) == 0 )
            {
                ::SetWindowPos(
                    m_hWnd,
                    NULL, 0, 0, 0, 0,
                    SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
                    |SWP_FRAMECHANGED
                    |SWP_SHOWWINDOW
                    );
            }
        }
        else
        {
            if( (dwWndStyle & WS_VISIBLE) != 0 )
                ::SetWindowPos(
                m_hWnd,
                NULL, 0, 0, 0, 0,
                SWP_NOSIZE|SWP_NOMOVE|SWP_NOZORDER|SWP_NOOWNERZORDER
                |SWP_HIDEWINDOW
                );
        }
    }
};
 
class CYourTabPageContainerWnd : public CExtTabPageContainerWnd
{
public:
    virtual CExtTabWnd * OnTabWndGetTabImpl()
    {
        return new CYourTabWnd;
    }
};

Chun Pong Lau Oct 3, 2006 - 10:29 AM

Where and how should I use the class CYourTabPageContainerWnd?

Technical Support Oct 3, 2006 - 12:38 PM

The CMainFrame class in your project should have the property of CExtTabPageContainerWnd type (or CExtTabPageContainerOneNoteWnd, or CExtTabPageContainerFlatWnd, or CExtTabPageContainerWhidbeyWnd, or CExtTabPageContainerButtonsWnd). You should use the CYourTabPageContainerOneNoteWnd type there instead.

Chun Pong Lau Oct 3, 2006 - 1:28 PM

Thank you very much. It works perfectly except the line:

LONG nItemCount = _BT::ItemGetCount();

will have a compiling error, "error C2653: ’_BT’ : is not a class or namespace name." I tried to change it to

LONG nItemCount = ItemGetCount();

and it seems it is ok now.

Please keep up the good job! You have given me a very good impression on your post technical support.

Thumbs up!

Alan