Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Dockable Property Sheet

Posted on 1998-06-21
1
Medium Priority
?
663 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 100 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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…
IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
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.

972 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