Help and Support
 

powered byLive Search

How To Prevent Static Splitter Bars from Tracking

Retired KB ArticleThis article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.
Article ID:105150
Last Review:November 21, 2006
Revision:3.2
This article was previously published under Q105150

SUMMARY

In addition to providing the ability to dynamically split a single view, the CSplitterWnd class provides a convenient method of displaying two or more view classes in a single frame. This type of splitter window is called a "static splitter." The CSplitterWnd class contains member functions that allow the splitter bar to be dragged by the mouse or moved using the keyboard to change the proportionate sizes of the views (or panes, in splitter terminology) within the frame.

Sometimes it is desirable to fix the initial position of the splitter bars and not allow the user to move them. This can be accomplished simply by deriving a class from CSplitterWnd and overriding several members. This method is outlined below.

MORE INFORMATION

1.Use ClassWizard to create a new class named CMySplitterWnd of class type "generic CWnd" and change the references to CWnd in the class declaration and BEGIN_MESSAGE_MAP macro to CSplitterWnd.
2.Using ClassWizard, create message handlers for WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK, and WM_MOUSEMOVE. Bypass the CSplitterWnd functionality in each of these overrides by calling the corresponding CWnd handlers. The following example illustrates the WM_LBUTTONDOWN handler:
      void CMySplitterWnd::OnLButtonDown(UINT nFlags, Cpoint point)
      {
         CWnd::OnLButtonDown(nFlags, point);
      }
						
3.Change any embedded CSplitterWnd members of your frame class to type CMySplitterWnd.
4.Remove any menu items that generate a ID_WINDOW_SPLIT command (such as the "Split" item on the VIEWEX sample's "Window" menu). This prevents CView::OnSplitCmd() from being called.

APPLIES TO
Microsoft Foundation Class Library 4.2, when used with:
  Microsoft Visual C++ 1.0 Professional Edition
  Microsoft Visual C++ 1.5 Professional Edition
  Microsoft Visual C++ 2.0 Professional Edition
  Microsoft Visual C++ 2.1
  Microsoft Visual C++ 4.0 Standard Edition
  Microsoft Visual C++ 4.1 Subscription
Microsoft Visual C++ 4.2 Professional Edition
Microsoft Visual C++ 5.0 Standard Edition

Back to the top

Keywords: 
kbhowto kbuidesign kbwndw KB105150

Article Translations

 

Other Support Options

  • Need More Help?
    Contact a Support professional by E-mail, Online or Phone.
  • Customer Service
    For non-technical assistance with product purchases, subscriptions, online services, events, training courses, corporate sales, piracy issues, and more.
  • Newsgroups
    Pose a question to other users. Discussion groups and Forums about specific Microsoft products, technologies, and services.