Invisible Splitter Window

Similar to "Windows Explorer" with Web Content Enabled

.

Environment: VC6, Windows 2000

When we want to create more than one view in the same view, we go for split windows. What if we don't want that splitter to be visible? (Like what we have in "Windows Explorer," but with Web content enabled.)

The class that I have provided here helps you to successfully hide the splitters. Making the splitter invisible by calling CWnd::ShowWindow(FALSE) won't work because Views are Child windows of the Splitter. When the parent is hidden, the child cannot be visible.

The only way is to override the OnDrawSplitter() function. There is a flag that decides the splitter to be visible or invisible (this is set in the constructor). Here we go...

void CSplitterWndEx::OnDrawSplitter(CDC *pDC, ESplitType nType,
      const CRect &rectArg)
{
  if (pDC == NULL)
  {
    RedrawWindow(rectArg, NULL, RDW_INVALIDATE|RDW_NOCHILDREN);
    return;
  }
  /**
  * If you want to see the splitter window,
  * Use the base class's drawing funcion;
  * otherwise, fill the Splitter with the View's color.
  */
    if(m_Visible)
    {
        CSplitterWnd::OnDrawSplitter(pDC,nType,rectArg);
        return;
    }
  ASSERT_VALID(pDC);
  CRect rect = rectArg;
  CPen WhitePen;
  WhitePen.CreatePen( PS_SOLID, 
                      PEN_WIDTH, 
                      GetSysColor(COLOR_WINDOW));
  pDC->SelectObject(&WhitePen);
  pDC->Rectangle(rect);
}

The next step is to disable the resizing capability of the splitter window. To disable those functionalities, override the following:

  • CSplitterWnd::OnMouseMove(UINT /*nFlags*/, CPoint pt);
  • CSplitterWnd::StartTracking(int ht);
  • CSplitterWnd::OnDrawSplitter(CDC* pDC, ESplitType nType,const CRect& rectArg);
  • CSplitterWnd::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message);
  • CSplitterWnd::OnMouseWheel(UINT fFlags, short zDelta, CPoint point);

This is a very simple way to hide the splitter window.

When using the splitter, call the construcor with FALSE to hide it and TRUE or without any parameter for a normal splitter window.

For an invisible splitter, use this code:

  CSplitterWndEx splitter(FALSE);    //Set visible to FALSE.
  splitter.CreateStatic(this,1,2);
  splitter.CreateView(0,0,RUNTIME_CLASS(CLeftView),
      CSize(120,120),pContext);
  splitter.CreateView(0,1,RUNTIME_CLASS(CTextView),
      CSize(128,0),pContext);

For a visible splitter, use this code:

  CSplitterWndEx splitter(TRUE);    // Set visible to TRUE
                                    // (or)
  CSplitterWndEx splitter;          // Default is TRUE.
                                    // Use the splitter.
  splitter.CreateStatic(this,1,2);
  splitter.CreateView(0,0,RUNTIME_CLASS(CLeftView),
      CSize(120,120),pContext);
  splitter.CreateView(0,1,RUNTIME_CLASS(CTextView),
      CSize(128,0),pContext);

Downloads

Download demo project - 8.00 Kb
Download source - 32.0 Kb

IT Offers

Comments

  • Lightweight smart – Nike Free TR Befit in shoot up 2013 3 series

    Posted by Tufffruntee on 04/24/2013 09:25am

    Nike Free TR Stalwart 3 noteworthy features is to purchase the additional scheme: Nike Let off 5 soles improved bending Scratch; stylish tractor pattern making training more focused when; lighter weight, the permeability is stronger, and more fashionable shoe designs not not exhort shoes [url=http://northernroofing.co.uk/roofins.cfm]nike free run uk[/url] more smug wearing, barefoot training feel, but also more in vogue appearance. Nike On the house TR Fit 3 provides supreme lateral solidity, you can deceive the legs in the part during training. Acrid vamp upper breathable webbing, disgrace suds's solitary delineate can be [url=http://markwarren.org.uk/goodbuy.cfm]nike free run uk[/url] seen under the aegis it. Lightweight, ragged, reduce bubbles matter familiar through entirely only one seams, more limber, advocate is stronger. Need more mainstay, part of a training vex, foam neck in more parts of the shortage championing give, effervescence loose. Put to use stand-in tongue moisture wicking mock materials, unshiny on your feet, help living feet tiring and comfortable. Phylite [url=http://turbo-vac.co.uk/components_13.cfm]nike free uk[/url] midsole offers lightweight revolt sustained, outstanding durability and stable outsole can do to greatly lower the comprehensive weight of the shoe. Qianzhang pods on the outsole and heel-shaped Grassland rubber enhances the shoe multi-directional purchase on sundry surfaces.

    Reply
  • Problems with source code

    Posted by Legacy on 07/12/2002 12:00am

    Originally posted by: The Chameleon

    The source code has problems accepting the stdafx.h

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Go Deeper

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds