Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create to different views in one window

Status
Not open for further replies.

mirr2001

Programmer
Mar 29, 2002
24
DK
Does anyone know, how i can create 2 different views in one window (split window). One one side i need CScrollView and on the other side CHtmlView. I am also open for real MDI suggestions.
I just need the CScrollView side printed.
 

Add OnCreateClient to CMainFrame as shown below. Copy and past the code in the below OnCreateClient into yours. Add CSplitterWnd m_wndSplitter; to your class as private. Take RUNTIME_CLASS(CResultsView), and replace it with RUNTIME_CLASS(ScrollView). Take RUNTIME_CLASS(CACGView) and replace it with RUNTIME_CLASS(CHtmlView). Of course you'll need to add the header files up top for the new classes. Play with the CSize() to adjust the sizes to your liking.

Brother C


BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/,
CCreateContext* pContext)
{
// create a splitter with 1 row, 2 columns
if (!m_wndSplitter.CreateStatic(this, 1, 2))
{
TRACE0("Failed to CreateStaticSplitter\n");
return FALSE;
}

// add the first splitter pane - the default view in column 0
if (!m_wndSplitter.CreateView(0, 0,
RUNTIME_CLASS(CResultsView),
CSize(150, 0), pContext))
{
TRACE0("Failed to create first pane\n");
return FALSE;
}

// add the second splitter pane - an input view in column 1
if (!m_wndSplitter.CreateView(0, 1,
RUNTIME_CLASS(CACGView),
CSize(0, 0), pContext))
{
TRACE0("Failed to create second pane\n");
return FALSE;
}

// activate the input view
SetActiveView((CView*)m_wndSplitter.GetPane(0,0));

return TRUE;
}
 
Now everything works; except one thing:
I cannot print the CScrollView side.
I've added a control handler to my derived CScrollView class, but it is not possible to call any standard handler on it. It works with the HTML side.
Can anyone tell me what to do?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top