Painter for CMyDocView does not inherit from CView - How to?

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Yellow.

I recently grabbed a free CDataGrid class, nice and lightweight and I want
to use this in my SDI view. I understand that my views (if I have more than
one) need to inherit from CView, or from a control which has CView as a base
class.

CDataGrid does not inherit from any MFC controls - it is entirely custom
written.

So I used the AppWizard CMyView and made a member pointer to my CDataGrid
class which instantiates along with the CMyView - no probs.

The WM_PAINT messages are being processed by the CDataGrid object (which in
its Create() call CreateWindowEx(...)), but I see nothing happening in the
client window!

Do I need to make the client view transparent? How?

I know the CDataGrid works, because once I Create()d it in the h_Wnd of the
menu and toolbars and I could see portions of it being drawn.

Why won't it appear in my SDI client window?
I am doing this:

void CTestGridView::OnInitialUpdate()
{
m_pDG = new CDataGrid();
RECT rect = {50,50,700,300}; // Create DataGrid child window
m_pDG->Create(rect, AfxGetMainWnd()->m_hWnd, 5);

//setup grid etc

CView::OnInitialUpdate();
}

Many thanks
Luke
(may the source be with you)


.



Relevant Pages

  • Re: Painter for CMyDocView does not inherit from CView - How to?
    ... I recently grabbed a free CDataGrid class, ... Why won't it appear in my SDI client window? ... Why are you not making the grid a child of the view? ... However the control still does not appear. ...
    (microsoft.public.vc.mfc)
  • Re: Painter for CMyDocView does not inherit from CView - How to?
    ... I recently grabbed a free CDataGrid class, nice and lightweight and I want to use this in my SDI view. ... So I used the AppWizard CMyView and made a member pointer to my CDataGrid class which instantiates along with the CMyView - no probs. ... Why are you not making the grid a child of the view? ...
    (microsoft.public.vc.mfc)
  • Re: Painter for CMyDocView does not inherit from CView - How to?
    ... Why do you think those sizes have any meaning whatsoever? ... Not sure what you mean by "I see nothing happening in the client window". ... your datagrid is just a piece of what is in the view. ... I recently grabbed a free CDataGrid class, nice and lightweight and I want ...
    (microsoft.public.vc.mfc)