How can I split a CDockablePane into two parts?

EDN Admin

Well-known member
Joined
Aug 7, 2010
Messages
12,794
Location
In the Machine
Hello, everybody.

I want to create a CDockablePane and split it into two parts: the left for a CMFCShellTreeCtrl and the right for a CMFCShellListCtrl, just like a "windows explorer" in a dockable pane. I tried to use CSplitterWndEx in the CDockablePane, but I failed. Here are the codes:

<font style="font-size:10px
<div style="border-right:#7f9db9 1px solid;border-top:#7f9db9 1px solid;font-size:11px;overflow:auto;border-left:#7f9db9 1px solid;line-height:100%! important;border-bottom:#7f9db9 1px solid;font-family:Courier New;background-color:white
<table style="border-top-width:0px;border-left-width:0px;margin:2px 0px;width:99%;border-bottom:#eee 0px solid;border-collapse:collapse;background-color:#fff;border-right-width:0px" cellspacing=0 cellpadding=0>
<colgroup>
<col style="padding-left:10px;font-size:11px;border-bottom:#f7f7f7 1px solid;font-family:Courier New;white-space:nowrap
<tbody>
<tr>
<td><font style="font-size:11px int CTestPane:nCreate(LPCREATESTRUCT lpCreateStruct)   </font></td></tr>
<tr>
<td style="background-color:#f7f7f7 {   </td></tr>
<tr>
<td>    if (CDockablePane:nCreate(lpCreateStruct) == -1)   </td></tr>
<tr>
<td style="background-color:#f7f7f7         return -1;   </td></tr>
<tr>
<td> </td></tr>
<tr>
<td style="background-color:#f7f7f7     // TODO: Add your specialized creation code here   </td></tr>
<tr>
<td>    // Create splitter window   </td></tr>
<tr>
<td style="background-color:#f7f7f7     if (!m_wndSplitter.CreateStatic(this, 1, 2))   </td></tr>
<tr>
<td>        return -1;   </td></tr>
<tr>
<td style="background-color:#f7f7f7  </td></tr>
<tr>
<td>    if ( !m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CPaneLeftView), CSize(200, 200), NULL) ||   </td></tr>
<tr>
<td style="background-color:#f7f7f7          !m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CPaneRightView), CSize(100, 100), NULL))   </td></tr>
<tr>
<td>    {   </td></tr>
<tr>
<td style="background-color:#f7f7f7         DWORD </font><font style="color:red nRet</font><font style="font-size:11px  = </font><font style="color:blue GetLastError</font><font style="font-size:11px ();   </font></td></tr>
<tr>
<td>        m_wndSplitter.DestroyWindow();   </td></tr>
<tr>
<td style="background-color:#f7f7f7         return -1;   </td></tr>
<tr>
<td>    }   </td></tr>
<tr>
<td style="background-color:#f7f7f7  </td></tr>
<tr>
<td>    return 0;   </td></tr>
<tr>
<td style="background-color:#f7f7f7 }  </td></tr></tbody></table>

<font style="font-size:12px where CTestPane is derived from CDockablePane, and CPaneLeftView includes a CMFCShellTreeCtrl member, CPaneRightView includes a CMFCShellListCtrl member.

I traced into CTestPane::OnCreate function and found all the "create" functions run successfully, but when I run the test program, I saw nothing: no splitter bar, no tree control and no list control.</font>
<font style="font-size:10px </font><font style="font-size:12px
As we can see, the "Class View"pane in Visual studio 2008 IDE is a splitted dockable pane, the upper one shows a class tree and the lower one show the members.

The question is: How can I split a CDockablePane into two parts, just like the "Class View" in VS2008 IDE? Or there is any other way to create a "windows explorer" in a dockable pane?

Thanks for any help!

Dynamic7
2008-10-5</font></font>

View the full article
 
Back
Top