Re: Inheritance and MFC
Hi David,
You cannot use multiple inheritance with multiple CObject-derived =
bases.
Only the left-most base can derive from CObject.
I am not quite sure what you mean by that?
I believe that is what I am doing.
I think I need CWnd to implement Scrollbars, so that is why I am =
inheriting from CWnd.
I think what I am actually doing is creating a control that contains =
controls.
This is basically what I have.
CGrid : public CObject
{
// Bunch of Stuff
}
CGridSB: public CGrid, public CWnd
{
CScrollbar sb;
CreateScrollbars();
SetScreenRect(){ Position Scrollbars(); }
}
CView::OnDraw()
{
CGridSB sb;
sb.SetScreenRect(Rect);
sb.OnDraw(pDC);
// Instead of creating and adding scrollbars here, I just need to =
figure out
// how to add the scrollbars to the grid object.
}
Thanks,
"David Wilkinson" <no-reply@effisols.com> wrote in message =
news:eKJEC0VvHHA.3364@TK2MSFTNGP02.phx.gbl...
Nobody wrote:
Hi,
I have a grid object. The Grid Object inherits from CObject.
There are no controls and I was thinking about adding some. Zoom, =
Pan, etc.
So, I have extantiated a new class that inherits from CGrid and CWnd.
class CGridSB : public CGrid, public CWnd
Now, I would like to add some controls to the Grid Object.
The problem is that the controls needs an m_hWnd
I am not sure what to do?
VERIFY(c_sbHZoom.Create(
SBS_VERT | SBS_RIGHTALIGN | WS_CHILD |WS_BORDER,
Rect,
this,
1234)
);
_AFXWIN_INLINE void CScrollBar::ShowScrollBar(BOOL bShow)
{ ASSERT(::IsWindow(m_hWnd)); ::ShowScrollBar(m_hWnd, SB_CTL, =
bShow); }
I understand that the CGridSB oject needs to handle the Scrollbar =
messages, so I need a message map
and perphaps a DECLARE_DYNCREATE along with an IMPLEMENT_DYNCREATE =
member.
Nobody:
You cannot use multiple inheritance with multiple CObject-derived =
bases.
Only the left-most base can derive from CObject.
--
David Wilkinson
Visual C++ MVP