Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS Tech Support » Creating a CFormView on the fly : display problem Collapse All
Subject Author Date
Jean-Yves Tremblay Jan 24, 2007 - 12:04 PM

Hi,

In a SDI app, I have to create a set of CFormViews (they are children of dynamic control bars) somewhere after
the creation of the frame.

I sucessfully create the CFormViews, but I am unable to redraw them. The controls never showing.

The only way i found to redraw the views is to resize the app.
I thought that pView->SendMessage(WM_INITIALUPDATE) would have made the job, since it calls InvalidateRect()

I tried with RedrawWindow(...), InvalidateRect(..), UpdateWindow(...) etc... nothing to do.

Here is my code :


MainFrame.h :

class VAB_GUI_BASE_API CVABMainFrame : public CExtNCW<CFrameWnd>
                                                               , public CExtDynamicBarSite
{
    ....
}


MainFrame.cpp

bool CVABMainFrame::CreateControlBarsSet(const std::vector<std::string>& vecControlBarCaptions)
{
    ...
    
    CVABExtDynamicBarSite::BarFreeAll();

    ...

    for (...)
    {
        ...

        pVar = ExtDynamicBarSite::BarAlloc("SomeTitle", CExtCmdIcon());
        ShowControlBar(pVar, TRUE, TRUE );
    }

    ...
    //Some docking
    ...

    for (...)
    {
        ...

        CView* pView = (CView*)(*itViewsMap).second.pViewClass->CreateObject();
        CCreateContext cc;

        cc.m_pNewViewClass = (*itViewsMap).second.pViewClass;
        cc.m_pCurrentDoc = (*itViewsMap).second.pDoc;
        cc.m_pCurrentFrame = this;
        cc.m_pLastView = NULL;
        cc.m_pNewDocTemplate = NULL;

        bRet &= (pView->Create(NULL, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, 
            CRect(0,0,0,0), (*itCbarsPtrMap).second, IDC_STATIC, &cc) != FALSE);
        pView->SendMessage(WM_INITIALUPDATE);
        
        pView->RedrawWindow();      //Nothing happens !!!!
    }

    RecalcLayout();

    return bRet;
}



ParamsEditorView.h :

class CParamsEditorView : public CExtWA < CExtWS < CExtAFV < CFormView> > >
{
    ...
}


Any Idea ?

Thanks in advance

Technical Support Jan 25, 2007 - 6:48 AM

Please check the following:

1) All the dialog template resources should have the WS_CLIPCHILDREN|WS_CLIP_SIBLINGS standard window styles set on.

2) Each group box should have a z-order that is less than z-orders of other dialog controls inside the group box.

Jean-Yves Tremblay Jan 24, 2007 - 9:25 PM

I found it, completely unrelated to painting.

It would be easier if I specified a bigger rectangle ;)

bRet &= (pView->Create(NULL, NULL, WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN, 
               CRect(0,0,0,0), (*itCbarsPtrMap).second, IDC_STATIC, &cc) != FALSE);