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 General Discussion » List Control's size is overflow!! Collapse All
Subject Author Date
Sujang Lee Dec 22, 2005 - 1:31 PM

http://earth.uos.ac.kr/~lsujang/example.gif


 


http://earth.uos.ac.kr/~lsujang/VideoShop.zip


 


class CMemberHandler : public CExtWA < CExtWS < CExtAFV < CFormView >  > >
{


}


 


void CMemberHandler::OnInitialUpdate()
{
      CFormView::OnInitialUpdate();
      AddAnchor(IDC_LIST1, __RDA_KEEP, __RDA_X);
}


 


The List Control’s X size is overflow.....


I want to make it correct... help me.

Sujang Lee Dec 22, 2005 - 1:37 PM
Technical Support Dec 23, 2005 - 10:59 AM

First of all please apply the CExtWA template to the parent class CFormView. You can follow the steps described in the FAQ "How to make CFormView to be look and act like CExtResizableDialog?" Now you can use the AddAnchor method to anchor you controls.

But you please mind one important thing. When the CFormView::OnInitialUpdate() method is called, the size of the form view is already changed. I.e. it is not equal to the original size of the loaded dialog template resource. So, if you try to anchor your controls in the OnInitialUpdate() method, some unexpected results will follow.

We recommend you set up anchors when the frame window, which contains form view, is created:

int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
        return -1;
 
    // create a view to occupy the client area of the frame
    m_pWndView = new CChildFormView;
    if (!m_pWndView->Create(
            NULL, 
            NULL, 
            AFX_WS_DEFAULT_VIEW, 
            CRect(0, 0, 0, 0), 
            this, 
            AFX_IDW_PANE_FIRST, 
            NULL
            )
        )
    {
        TRACE0("Failed to create view window\n");
        return -1;
    }
 
    ....
 
    if( !m_wndMenuBar.Create(
            NULL,
            this,
            ID_VIEW_MENUBAR
            )
        )
    {
        TRACE0("Failed to create menubar\n");
        return -1;      // failed to create
    }
 
    m_pWndView->AddAnchor( IDC_YOUR_CONTROL, __RDA_LT, __RDA_RT );
 
 
....

Technical Support Dec 23, 2005 - 2:10 AM

To fix this problem is easier than you think. Just invoke the class wizard and add the WM_SIZE standard windows message handler to your CFormView-derived class. This method should invoke CWnd::OnSize() instead of CFormView::OnSize() invocation generated by wizard.