Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
Objective Toolkit User's Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

22.10 Using the Docking Views Architecture

The topics that follow demonstrate how to utilize docking views in your applications.

22.10.1 To incorporate docking views into your application

  1. Incorporate docking windows into your application. See Section 21.5, "Using the Advanced Docking Windows Architecture," for more information.

  2. In the InitInstance() method of your application object, modify your document template class to utilize SECMultiDocTemplate in place of CMultiDocTemplate.

    Docking views are not supported by SDI applications.

22.10.2 To set docking view styles

See Section 8.11.7, "To set the style of a docking window." In this chapter, see Section 22.4, "Docking Views Options."

22.10.3 To toggle the presence of the docking button on a dockable view frame

  1. Create an SECMultiDocTemplate-derived class. Add the static data member, m_bDockingViewCaptionButton, to this class. Because it is static, this flag affects every docking view. For example:

  2. In the new class, override the OnEnableSysCommandEx() method to set the SCXOPT_NO_CAPTION_BUTTON style based conditionally on the state of m_bDockingviewCaptionButton, and then call the base class implementation. This override ensures that each new frame has the appropriate docking style.

  3. In the InitInstance() method of your application object, modify your document template class to utilize the SECMultiDocTemplate-derived class.

  4. In the view class, add a new method, UpdateParentFrame(). This method updates the frame so they reflects the current state of the caption button.

  5. Add a toolbar button or a menu item handler that toggles the state of the caption button for the current view.

    See the mdi sample in the <stingray-installdir>Samples\Toolkit\MFC\DockingViews\Bounce subdirectory for a demonstration of this technique.

22.10.4 To disable right mouse double-clicks on the docking view caption bar

See Section 22.10.3, "To toggle the presence of the docking button on a dockable view frame," and replace SCXOPT_NO_CAPTION_BUTTON with SCXOPT_NO_HANDLE_RDBLCLK.

22.10.5 To create an initially docked view

When you call OpenDocumentFile(), which is typically in the InitInstance() method of your application object, specify the bInitiallyDocked parameter (the third parameter) to be TRUE. It defaults to FALSE if not specified. For example:

22.10.6 To start an application with no initial view

Insert the following line immediately before the call to ProcessShellCommand() in the application object's InitInstance() method.

22.10.7 To put a splitter in a docking view

  1. Add a CSplitter object as a member variable in your view. You need to make the splitter a member of the view instead of the frame because the frame does not survive the docking process. For more information, see Section 22.7, "Docking Views Containment Model." For example:

  2. In the OnCreate() method of the view, create the splitter window:

  3. Then, add additional windows or views.

  4. Add an OnSize() method to resize the splitter as needed.

The OnCreate() method of the view has the LPCREATESTRUCT lpCreateStruct parameter. One of the members of this structure contains the pointer to the CCreateContext:

The source code for this section was taken from our SplitView sample application in <stingray-installdir>\Samples\Toolkit\MFC\DockingViews\DockTabs\SpltView.cpp.

22.10.8 To dock a view

Have your CView send a WM_SYSCOMMANDEX message to its current parent frame window. For example, the following code notifies the frame that the view is to be docked to the right.

For a list of SCXID parameters, see Section 22.8, "WM_SYSCOMMANDEX."

22.10.9 To float a view as an MDI child

From your CView, send a WM_SYSCOMMANDEX message to its current parent frame window. For example:

For a list of SCXID parameters, see Section 22.8, "WM_SYSCOMMANDEX."

22.10.10 To obtain a pointer to the view

Within the context of your application's main frame object (SECMDIFrameWnd-derived), call the SECMDIFrameWnd::GetActiveFrame() and CFrameWnd::GetActiveView() methods. For example:

CMDIFrameWnd::MDIGetActive() does not return the appropriate value for a docked view.

22.10.11 To control the initial size and position of a docking view as it is docked

  1. Derive a class from SECMultiDockTemplate.

  2. Override SECMultiDocTemplate::ToggleDocking(CFrameWnd* pFrame).

  3. In the override, issue a call to the SECMultiDockTemplate::Dock() method instead of invoking the base class. Because this method is overloaded, you need to call the overload that accepts the SECDockPos() and SECDockSize() parameters. For example:



Previous fileTop of DocumentContentsNo linkNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo, and Stingray, are registered trademarks of Rogue Wave Software. All other trademarks are the property of their respective owners.
Provide feedback to Rogue Wave about its documentation.