Solved

Dockable Property Sheet

Posted on 1998-06-21
1
635 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

[Live Webinar] The Cloud Skills Gap

As Cloud technologies come of age, business leaders grapple with the impact it has on their team's skills and the gap associated with the use of a cloud platform.

Join experts from 451 Research and Concerto Cloud Services on July 27th where we will examine fact and fiction.

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

617 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