0
votes

How can I dock a CControlBar derived window to the middle of a splitter window (CSplitterWnd)? I would like the bar to be repositioned whenever the splitter is moved.

To make it a little clearer as to what I'm after, imagine the vertical ruler in the Dialog Editor in Visual Studio (MFC only). It gets repositioned whenever the tree view is resized.

2

2 Answers

1
votes

Alf,

In case of VS, there's no splitter used: The resource view is a resizable ControlBar (It looks and feels like a splitter but it isn't a CSplitterWnd). The rest is a child frame (either tabbed or MDI. Go to Tools/Options/Environment/General and choose Multiple Documents to convince yourself). The ruler is part (controlbar?) of the child frame.

In your case, I think you don't want a 3 panes splitter. You need a 2 pane splitter and the control bar should be part of your view (it wouldn't be a CControlBar per se). Unless you use MDI in which case you can make it a true ControlBar in your child frame.

HTH

0
votes

Serge, I apologize, I wasn't very clear. The splitter would be between the resource view and the ruler bar. It would looke like this:

Resource View | Vertical ruler | View

In any case, I found the (now obvious) answer: split the main frame into three windows:

m_wndSplitter.CreateStatic(this, 1, 3);

m_wndLeftPane.Create(&m_wndSplitter,WS_CHILD|WS_VISIBLE,m_wndSplitter.IdFromRowCol(0, 0));
m_ruler.Create(&m_wndSplitter,WS_CHILD|WS_VISIBLE,m_wndSplitter.IdFromRowCol(0, 1));

m_wndSplitter.CreateView(0, 2, pContext->m_pNewViewClass, CSize(300, 0), pContext);
SetActiveView((CScrollView*)m_wndSplitter.GetDlgItem(m_wndSplitter.IdFromRowCol(0, 2)));