Solved

Dockable Property Sheet

Posted on 1998-06-21
1
616 Views
Last Modified: 2012-06-27
I know how to create a dockable dialogbar. However, it seems that the method cannot be applied in creating a property sheet. Please provide me with some guidance.
0
Comment
Question by:tseekoy
1 Comment
 

Accepted Solution

by:
alesatang earned 50 total points
ID: 1166411
Hello, tseekoy, You got deeper into the topic. So, the Visual Sudio style interface is very attractive.
In fact, you can not create a dialog bar liked property sheet. But you can get ClassView style windows by a CControlBar, a CTabCtrl, and some other control.
Following is a sample, which introduce:
1.  Derive class from CControlBar.
2.  Override the CControlBar Create() memeber function. In Create, a CTabCtrl was Created, and a Edit Control, a Lis Control, a Tree Control were created.  If you want to the Tab has Icon, before the CTabCtrl created, a CImageList should be created
enum OUTPUT_WINDOWS{
      OUTPUT_TTY,      
      OUTPUT_LIST,
      OUTPUT_TREE
};BOOL COutputWnd::Create(CWnd* pParentWnd, DWORD dwStyle, UINT nID)
{
      ASSERT_VALID(pParentWnd);   // must have a parent

      // save the style
      m_dwStyle = (UINT)dwStyle;

      // create the HWND
      CRect rect;
      rect.SetRectEmpty();
      LPCTSTR lpszClass = AfxRegisterWndClass(0, ::LoadCursor(NULL, IDC_ARROW),
            (HBRUSH)(COLOR_BTNFACE+1), NULL);
      if (!CWnd::Create(lpszClass, NULL, dwStyle, rect, pParentWnd, nID))
            return FALSE;

      // Note: Parent must resize itself for control bar to be resized
      InitializeImageList();
      m_pTabCtrl=new CTabCtrl;
      m_pTabCtrl->Create(WS_CHILD|WS_VISIBLE|
                        TCS_FORCEICONLEFT|TCS_TABS,
                        rect,this, IDC_TABCONTROL);
      m_pTabCtrl->SetImageList(&m_ImageList);
      
      m_pTerminal=new CEdit;
      m_pTerminal->Create(WS_CHILD|WS_VISIBLE|WS_VSCROLL|
                        ES_AUTOVSCROLL|ES_AUTOVSCROLL|ES_MULTILINE,
                        rect,this, IDC_EDITCTRL);
      m_pList      =CListCtrl;
      m_pList->Create(WS_CHILD|LVS_REPORT, rect,this, IDC_LISTCTRL);
      m_pTree      =CTreeCtrl;
      m_pTree-> Create(WS_CHILD| TVS_HASLINES| TVS_HASBUTTONS ,rect,this, IDC_TREECTRL);



      AddTab(0,"Pane1",II_TTY);
      AddTab(1,"Pane2",II_LIST);
      AddTab(2,"Pane3",II_TREE);
      // set initial font and calculate bar height
      SendMessage(WM_SETFONT, (WPARAM)globalData.hStatusFont);
      return TRUE;
}
Notice, only one control has WS_VISIBLE style, only this control can bevisible after  creted

3 process Tab Control notification TCN_SELCHANGE, show selected pane, hide previous pane
      ON_NOTIFY(TCN_SELCHANGE, IDC_TABCONTROL, OnTabCtrlSelchange)
void COutputWnd::OnTabCtrlSelchange(NMHDR* pNMHDR, LRESULT* pResult)
{
      //Hide all pane at first
      int cursel=m_TabCtrl.GetCurSel();
      m_Terminal.ModifyStyle(WS_VISIBLE,0);
      m_pList->ModifyStyle(WS_VISIBLE,0);
      m_pTree-> ModifyStyle(WS_VISIBLE,0);
      //      Then, show the selected pane
      switch(cursel){
      case OUTPUT_TTY:
            m_Terminal.ModifyStyle(0,WS_VISIBLE);
            m_Terminal.Invalidate();
            break;
      case OUTPUT_LIST:
            m_pList->ModifyStyle(0, WS_VISIBLE);
            m_pList->Invalidate();
            break;
      case OUTPUT_TREE:
            m_pTree->ModifyStyle(0, WS_VISIBLE);
            m_pTree->Invalidate();
            break;
      default:
            ASSERT(FALSE);
            break;
      }
}
4 Override OnSize Member to resize the controls when the Frame position or size changed.
void COutputWnd::OnSize(UINT nType, int cx, int cy)
{
      CControlBar::OnSize(nType, cx, cy);

      // adjust m_cxSizeBox if necessary
      OnWinIniChange(NULL);      

      if(cx>0)
      {
            RECT rc;
            GetClientRect(&rc);
            m_pTabCtrl->MoveWindow(&rc);
            rc.left+=5;rc.right-=5;            //Remove the border size
            rc.top+=28;rc.bottom-=5;
            m_pTerminal->MoveWindow(&rc);
            m_pTerminal->RedrawWindow();
            m_pList->MoveWindow(&rc);
            m_pTree->MoveWindow(&rc);
      }
      // force repaint on resize (recalculate stretchy)
      Invalidate();
}

0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question