Solved

Dockable Property Sheet

Posted on 1998-06-21
1
606 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Converting to C# also VS2015 5 117
Find Visual Studio Tools 2 92
Unresolved External Symbols 3 68
Unable to start eclipse ? 17 133
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
What is C++ STL?: STL stands for Standard Template Library and is a part of standard C++ libraries. It contains many useful data structures (containers) and algorithms, which can spare you a lot of the time. Today we will look at the STL Vector. …
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.

867 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now