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 General Discussion » About CProfStudioThinFrame Collapse All
Subject Author Date
tarou iiyama Oct 11, 2005 - 2:06 AM

  Prof Samples


**************************************************************************


class CProfStudioThinFrame : public CWnd
{
 bool m_bAutoDestroyOnPostNcDestroy;
public:
 CProfStudioThinFrame()


**************************************************************************


    CProfStudioThinFrame * pWndThinFrame = new CProfStudioThinFrame;
    if( ! pWndThinFrame->CreateDynamicThinFrame( &m_wndView ) )
    {
        ASSERT( FALSE );
        return FALSE;
    }
    pWndThinFrame->ModifyStyle( 0, WS_CLIPCHILDREN | WS_CLIPSIBLINGS );


**************************************************************************


 There is a sample such as the above.
Please teach a theory.
And please teach a reason.

Technical Support Oct 11, 2005 - 1:32 PM

If you take a look at the GUI implemented in Visual Studio .NET, you will notice that many windows and controls inside dockable resizable bars have a thin (one pixel wide) border. So, we decided to provide Prof-UIS users with such a feature, which is adding a thin border to any window. This can be done in one of the following ways:

1) You can implement this border in the non-client area of the window inserted into CExtControlBar. For that, just use our CExtWRB template class (WRB stands for Window in Resizable Bar). This template class implements the WindowProc() virtual method for recomputing and repainting the non-client area of a window. So, please use CExtWRB < CExtResizableDialog > type instead of CExtResizableDialog to add a thin border to your dialog window. But, the CExtWRB class is not good when applied to windows which have non-client scroll bar areas. As we said above, the CExtWRB class recomputes and repaints the non-client area of the window. So, scroll bars are simply "killed".

2) You can also use the CProfStudioThinFrame class from the ProfStudio sample to implement such a thin border. This class does not modify the non-client area. It is a stand alone window that has its own thin border. The CProfStudioThinFrame class is designed to be a container for another window. This child window is automatically resized to fit all the inner area of the CProfStudioThinFrame window. So, this implementation of the thin border does not affect the scroll bars in its child window. To use it with windows inside the resizable control bar, create a resizable control bar (the m_wndBar in the code snippet below, created in part A) and its child window (the m_wndInside in the code snippet below, created in part B). After that, you should create a CProfStudioThinFrame container (created in part C) with the window in the resizable bar (m_wndInside):

    if(    // PART A
           (! m_wndBar.Create(
                _T("My resizable bar caption"),
                this,
                ID_VIEW_MY_RESIZABLE_BAR
                ) )
           // PART B
        || (! m_wndInside.Create(
                . . .
                &m_wndBar,
                . . .
                ) )
           // PART C
        || (! (new CProfStudioThinFrame)->
                CreateDynamicThinFrame(
                &m_wndInside
                ) ) )
       )

    {
        TRACE0("Failed to create my resizable bar\n");
        return . . .;
    }
Before the code enters part C, the m_wndInside window is a child of the m_wndBar window. After that, m_wndInside is a child of the dynamically created CProfStudioThinFrame window. The CProfStudioThinFrame window is a child of the m_wndBar window. So, the CProfStudioThinFrame window simply injects itself between the m_wndInside and m_wndBar windows. The CProfStudioThinFrame class automatically deletes itself when the window layout is destroyed. This allows you to forget about it after its initialization is complete.

tarou iiyama Oct 12, 2005 - 7:12 PM

Thank you for advice.