Solved

Dockable Property Sheet

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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to convert c++ code to Android App 3 131
Header of docx file 17 131
Path to  STL Map header file 1 80
How to convert Structure to vector of byte and vice versa 5 31
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
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 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 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.

749 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