Splitter Window and CScrollView
Experts:
My application needs a horizontal splitter window with two views (view A and view B). These two views have different style and content. View A will
show some messages by edit box and combo box, so I make View A derived from CFormView. View B will display a bunch of messages and data
in the loop line by line. I am thinking to derive it from CScrollView because I only want to display messages not edit them and I need the scroll bar
when message is over 1 screen.
My questions are: (1). Is that a good choice to make view B derived from CScrollView. Is there any choice better than this to implement view B's
functionality ? (2). I tried a simple example to display a bunch information on a CScrollView (by TextOut()). But the Scroll Bar didn't show on the right side. How should I do to bring up the scroll bar? (3). How to implement the splitter window who has two different views with different content ?
Re: Splitter Window and CScrollView
Hi
(1) sounds reasonable
(2) did u use SetScrollSizes (maybe in OnInitialUpdate)
(3) if i remember correctly CreatePane takes a runtime class argument, so just use the right one
gree(n)things
chrislaw
Re: Splitter Window and CScrollView
I just worked on this problem myself. In terms of making a splitter window take content from two different views try the following:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
if (!m_wndSplitter.CreateStatic(this, 2, 1))
{
TRACE0("Failed to Create Static Splitter\n");
return FALSE;
}
if (!m_wndSplitter.CreateView(0, 0, //top pane
RUNTIME_CLASS(CDfdView), CSize(225, 225), pContext))
{
TRACE0("Failed to create top pane\n");
return FALSE;
}
if (!m_wndSplitter.CreateView(1, 0, //bottom pane
RUNTIME_CLASS(CFsdView), CSize(225, 125), pContext))
{
TRACE0("Failed to create bottom pane\n");
return FALSE;
}
return TRUE;
}
CDfdView and CFsdView are two different view classes.