CListView && Scrollbars again
Han Martens ME -- 100331.3624@CompuServe.COM
Friday, April 26, 1996
Environment: Windows 95 / VC 4.1
Hello,
I posted a message last week, that resulted in one reply with a simple solution
that did not suffice. Unfortunately I did not describe the problem(s) I am
having in a very good way. So here I go again.
I created an MDI Application, using a static splitter window in the MDI child's
frame. I want to put two different views in two panes. To do so I entered the
following in my ChildFrame's OnCreateClient member fuction:
BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
VERIFY(m_wndSplitter.CreateStatic(this, 2, 1));
VERIFY(m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CSimView), CSize(100,100),
pContext));
VERIFY(m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CTableView),
CSize(100,100), pContext));
return TRUE;
}
And it works. Hoorah!
CTableView is derived from CListView (LVS_REPORT type). In the OnInitialUpdate
member of CTableView I set the column header names of the associated ListCtrl.
So far so good.
Questions:
1. After the initial update of the CTableView, there is no horizontal
scrollbar, although it is required, since not all columns can be shown.
Resizing the window a little does make the scrollbar appear. Putting a
ShowScrollBar() call in OnInitialUpdate() does make it appear, but with
the wrong scrollrange settings. I tried issueing a RecalcLayout()
call, but can not find an object to call it on. The m_pSplitterWnd
should be the one, but that does not seem to work either. Any
suggestions?
2. How can I tell my document that it should send messages to
CTableView when I call UpdateAllViews()? In other words, is it possible
to enter more that one viewclass in the AddDocTemplate() call?
I know that I don't seem to be too bright, but that is just a
smokescreen I am building :-)
Regards,
Han Martens
[Martens Engineering - 100331.3624@compuserve.com]
Sammi -- sigarashi@geographix.com
Monday, April 29, 1996
Environment: Windows 95 / VC 4.1
Hello,
I posted a message last week, that resulted in one reply with a simple
solution
that did not suffice. Unfortunately I did not describe the problem(s) I
am
having in a very good way. So here I go again.
I created an MDI Application, using a static splitter window in the MDI
child's
frame. I want to put two different views in two panes. To do so I entered
the
following in my ChildFrame's OnCreateClient member fuction:
BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext*
pContext)
{
VERIFY(m_wndSplitter.CreateStatic(this, 2, 1));
VERIFY(m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CSimView),
CSize(100,100),
pContext));
VERIFY(m_wndSplitter.CreateView(1, 0, RUNTIME_CLASS(CTableView),
CSize(100,100), pContext));
return TRUE;
}
And it works. Hoorah!
CTableView is derived from CListView (LVS_REPORT type). In the
OnInitialUpdate
member of CTableView I set the column header names of the associated
ListCtrl.
So far so good.
Questions:
1. After the initial update of the CTableView, there is no horizontal
scrollbar,
although it is required, since not all columns can be shown. Resizing the
window
a little does make the scrollbar appear. Putting a ShowScrollBar() call
in
OnInitialUpdate() does make it appear, but with the wrong scrollrange
settings.
I tried issueing a RecalcLayout() call, but can not find an object to
call it
on. The m_pSplitterWnd should be the one, but that does not seem to work
either.
Any suggestions?
I have a similar Splitter window. Here's what I've done.
***************** sample *********************
m_pSplitterWnd->SetScrollStyle( SB_HORZ);
m_pSplitterWnd->RecalcLayout();
***************** end of sample **************
Place those two lines in CChildFrame::OnCreateClient() and see what
happens. It should work. Note that the 2 views share ONE horizontal
scroll bar in this case.
2. How can I tell my document that it should send messages to CTableView
when
I
call UpdateAllViews()? In other words, is it possible to enter more that
one
viewclass in the AddDocTemplate() call?
Call AddDocTemmplate() once with CSimView and again with CTableView.
If you do not want the views to share ONE horizontal scroll bar, you
should set the scroll range and position inside each view's
::OnInitialUpdate.
I hope this info helps.
| Вернуться в корень Архива
|