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 » I want to connect an anchor to control in CFormView. Collapse All
Subject Author Date
tera tera Feb 18, 2010 - 8:00 PM

Hello.


I want to connect an anchor to control in CFormView.

Please teach the connection method of the anchor.

In addition, will not there be the thing equivalent to OnInitDialog in CFormView?



 


void CNxfMainView::OnInitialUpdate() {  CFormView::OnInitialUpdate();

 if ( SMART(m_pHekiItiGridWnd) == NULL ){   m_pHekiItiGridWnd.reset(new CNxfHekimenItiGrid );

if (! m_pHekiItiGridWnd->SubclassDlgItem ( IDC_MAIN_VIEW_GRID , this )){ return ; } //AddAnchor ( m_pHekiItiGridWnd->m_hWnd , __RDA_LT, __RDA_RB );

m_pHekiItiGridWnd->InitGrid();      m_pHekiItiGridWnd->ColumnAdd ( 10 );      m_pHekiItiGridWnd->RowAdd ( 10 );  }

 ShowSizeGrip( FALSE );

Technical Support Feb 23, 2010 - 12:32 PM

If you don’t need scrolling in your form view, then the test project referred in our previous e-mail is not needed. You should remove the scrolling from the form view window like we described in our previous answer and use the CExtWS < CExtWA < CExtAFV < CFormView > > > class as the base class of your form view window.

If you decided to switch using CExtResizableDialog window instead of MFC’s form view window. Then you should derive you view from the generic CView MFC view class and create the child CExtResizableDialog window inside it.


tera tera Feb 23, 2010 - 6:43 PM

I was able to program it.

However, is the how to compose of such a program all right?


IMPLEMENT_DYNCREATE(CNxfWinView, CView )

    :     :     :     :

BEGIN_MESSAGE_MAP(CNxfWinView, CView)     //{{AFX_MSG_MAP(CNxfWinView)  ON_WM_CONTEXTMENU()      ON_WM_ERASEBKGND()     ON_WM_SETFOCUS()     //}}AFX_MSG_MAP END_MESSAGE_MAP()

 

int CNxfChildFrame::OnCreate(LPCREATESTRUCT lpcs) {  if( CMuChildFrame :: OnCreate( lpcs ) == -1 )   return -1;

 ASSERT( m_hChildFrameIcon != NULL );  SetIcon( m_hChildFrameIcon, FALSE );  SetIcon( m_hChildFrameIcon, TRUE );

 if( ! m_cNxfWinView.Create(    NULL, NULL, WS_CHILD|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN,    rectDefault, this , AFX_IDW_PANE_FIRST )   )  {   ASSERT( FALSE );   return -1;  }

 if( ! m_InDlg.Create(   CNxfHekimenItiInDlg::IDD,   &m_cNxfWinView   //&m_wndScrollContainer*/   )  ){   ASSERT( FALSE );   return -1;  }  m_cNxfWinView.Wnd_( &m_cNxfHekimenItiInDlg ); }

    :     :     :     :

LRESULT CNxfWinView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) {

    LRESULT r_res = 0;     if( m_pWnd != NULL ){     r_res = m_pWnd->SendMessage ( message, wParam, lParam );     if ( message == WM_SIZE ){    CRect rcWnd;    GetWindowRect( &rcWnd );    m_pInDlg->SetWindowPos( &CWnd::wndBottom , 0 , 0 , rcWnd.Size().cx , rcWnd.Size().cy , SWP_SHOWWINDOW | SWP_NOMOVE );     }  }

    return( (r_res==0)? CView::WindowProc(message, wParam, lParam):r_res ); }

Technical Support Feb 24, 2010 - 1:02 PM

First of all, the CNxfWinView::WindowProc() method looks like very aggressive and, probably incorrect. It sends all the messages of the CNxfWinView window to some other window. This is definitively incorrect. Please describe us what you tried to implement using such aggressive code and we will try to help you.
Second, the ON_WM_ERASEBKGND() handler looks like not needed. You are moving child dialog to cover entire view window area.
We guess the CNxfWinView::WindowProc() method should look like:

LRESULT CNxfWinView::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
LRESULT lr = CView::WindowProc(message, wParam, lParam);
            if( message == WM_SIZE && m_pInDlg->GetSafeHwnd() != NULL )
            {
                        CRect rcWnd;
                        GetClientRect( &rcWnd );
                        m_pInDlg->SetWindowPos( &CWnd::wndBottom , 0 , 0 , rcWnd.Size().cx , rcWnd.Size().cy , SWP_SHOWWINDOW );
            }
    return lr;
}

Technical Support Feb 21, 2010 - 12:18 PM

The anchoring and scrolling features are incompatible with each other. If you want to use the anchoring feature in the CExtWA < CExtAFV < CFormView > > - derived class, then you should make it non-scrollable. You should add the handler methods for the WM_SIZE, WM_HSCROLL and WM_VSCROLL messages and invoke the <class>CWnd</code> methods instead of parent class methods. Here is the example:

void CChildFormView::OnSize( UINT nType, int cx, int cy ) 
{
            CWnd::OnSize( nType, cx, cy );
}

You should make your form view class based on the CExtWS class to make its background themed. I.e. you should derived your form view class from the CExtWS < CExtWA < CExtAFV < CFormView > > > class.
If you need to use both anchoring and scrolling, then you should not use the MFC form views. You should use the CExtScrollContainerWnd window with the CExtResizableDialog dialog created inside it like demonstrated in the following test project:

http:www.prof-uis.com/download/forums/TestScrollDialog3.zip

tera tera Feb 23, 2010 - 1:18 AM

Hello.


>http:www.prof-uis.com/download/forums/TestScrollDialog3.zip


I do not use scroll bar.

I want to use the anchor of the dialog.

In this case how should I do it?