15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


ActiveX Documents and SplitterWnd Views

Ratnakar Dev -- rdev@inacom.com
Friday, December 06, 1996

Environment: VC++4.2b, Win95

Hi,

I am looking for help on a problem with a View not being refreshed in 
the CSplitterWnd class, in an ActiveX Document application.

The CSplitterWnd class member is created in the COleDocIPFrameWnd
derived class of the application. This provides a way for the application 
to create a two pane SplitterWindow when it is invoked from IE 3.0.

The splitter window is also created in CFrameWnd derived class of the 
application for cases where the application is invoked standalone.
This case works fine. All the views are updated correctly, resized 
correctly.

When the application is invoked from IE 3.0, the CSplitterWnd classview
(which is a CListView derived class) is drawn correctly the first time
and then redrawn with a blank view. This also happens when the IE 3.0
is resized. 

Is there a solution to this problem?

Thanks,
R Dev

The code for Message handling functions for the errant View
is shown below
---------------------------------------------------------------------------------------------------------------------
int COptionsView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{

	lpCreateStruct->style |= LVS_ICON;
	
	if (CListView::OnCreate(lpCreateStruct) == -1)
		return -1;
	
	return 0;
}
>void COptionsView::OnActivateView(BOOL bActivate, CView* 
pActivateView, CView* pDeactiveView) 
{


CListView::OnActivateView(bActivate, pActivateView, pDeactiveView);
	if(pDeactiveView != NULL)	
		{
	pDeactiveView->SetFocus(); // Make sure focus is restored.
		}
	
}

void COptionsView::OnSetFocus(CWnd* pOldWnd) 
{
	CListView::OnSetFocus(pOldWnd);

	COleClientItem* pActiveItem = 
GetDocument()->GetInPlaceActiveItem(this);
	if (pActiveItem != NULL &&
		pActiveItem->GetItemState() == 
COleClientItem::activeUIState)
	{
		// need to set focus to this item if it is in the same 
view
		CWnd* pWnd = pActiveItem->GetInPlaceWindow();
		if (pWnd != NULL)
		{
		pWnd->SetFocus();   // don't call the base 
class
			return;
		}
	}

	CListView::OnSetFocus(pOldWnd);
	
}

void COptionsView::OnSize(UINT nType, int cx, int cy) 
{

	// CView::OnSize(nType, cx, cy);
	CListView::OnSize(nType, cx, cy);

	//	UpdateActiveItem();	
}

void COptionsView::UpdateActiveItem()
{
	trace("COptionsView::UpdateActiveItem\n");

	COleClientItem* pActiveItem = 
GetDocument()->GetInPlaceActiveItem(this);
	if (pActiveItem != NULL &&
		pActiveItem->GetItemState() == 
COleClientItem::activeUIState)
	{
		// this will update the item rectangles by calling
		//  OnGetPosRect & OnGetClipRect.
		pActiveItem->SetItemRects();
	}
}

void COptionsView::OnUpdate(CView* pSender, LPARAM lHint, CObject* 
pHint) 
{
	
	CListView::OnUpdate(pSender, lHint, pHint); 

	switch (lHint)
	{
	case HINT_UPDATE_WINDOW:    // redraw entire window
		Invalidate(FALSE);
		break;
	default:    
		break;
	};	
}

BOOL COptionsView::OnScrollBy(CSize sizeScroll, BOOL bDoScroll) 
{

	// return CListView::OnScrollBy(sizeScroll, bDoScroll);
	// do the scroll
	if (!CListView::OnScrollBy(sizeScroll, bDoScroll))
		return FALSE;

	// update the position of any in-place active item
	if (bDoScroll)
	{
		UpdateActiveItem();
		UpdateWindow();
	}
	return TRUE;
}



jmitchell@derwent.co.uk
Tuesday, December 10, 1996

     I had the same problem. What you need to do is override 
     COleServerDoc::CreateInPlaceFrame and inside there set the parent of 
     your splitter window that is in your CMainFrame to the COleIPFrameWnd 
     that you create.
     
     Justin Mitchell
     
     
______________________________ Reply Separator _________________________________
Subject: ActiveX Documents and SplitterWnd Views
Author:   (Ratnakar Dev) at Internet 
Date:    12/6/96 11:19 AM
     
     
Environment: VC++4.2b, Win95
     
Hi,
     
I am looking for help on a problem with a View not being refreshed in 
the CSplitterWnd class, in an ActiveX Document application.
     
The CSplitterWnd class member is created in the COleDocIPFrameWnd
derived class of the application. This provides a way for the application 
to create a two pane SplitterWindow when it is invoked from IE 3.0.
     
The splitter window is also created in CFrameWnd derived class of the 
application for cases where the application is invoked standalone. 
This case works fine. All the views are updated correctly, resized 
correctly.
     
When the application is invoked from IE 3.0, the CSplitterWnd classview 
(which is a CListView derived class) is drawn correctly the first time 
and then redrawn with a blank view. This also happens when the IE 3.0 
is resized. 
     
Is there a solution to this problem?
     
Thanks,
R Dev
     
The code for Message handling functions for the errant View 
is shown below
--------------------------------------------------------------------------------
-------------------------------------
int COptionsView::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{
     
        lpCreateStruct->style |= LVS_ICON;
     
        if (CListView::OnCreate(lpCreateStruct) == -1)
                return -1;
     
        return 0;
}
>void COptionsView::OnActivateView(BOOL bActivate, CView* 
pActivateView, CView* pDeactiveView) 
{
     
     
CListView::OnActivateView(bActivate, pActivateView, pDeactiveView);
        if(pDeactiveView != NULL)       
                {
        pDeactiveView->SetFocus(); // Make sure focus is restored.
                }
     
}
     
void COptionsView::OnSetFocus(CWnd* pOldWnd) 
{
        CListView::OnSetFocus(pOldWnd);
     
        COleClientItem* pActiveItem = 
GetDocument()->GetInPlaceActiveItem(this);
        if (pActiveItem != NULL &&
                pActiveItem->GetItemState() == 
COleClientItem::activeUIState)
        {
                // need to set focus to this item if it is in the same 
view
                CWnd* pWnd = pActiveItem->GetInPlaceWindow(); 
                if (pWnd != NULL)
                {
                pWnd->SetFocus();   // don't call the base 
class
                        return;
                }
        }
     
        CListView::OnSetFocus(pOldWnd);
     
}
     
void COptionsView::OnSize(UINT nType, int cx, int cy) 
{
     
        // CView::OnSize(nType, cx, cy);
        CListView::OnSize(nType, cx, cy);
     
        //      UpdateActiveItem();     
}
     
void COptionsView::UpdateActiveItem() 
{
        trace("COptionsView::UpdateActiveItem\n");
     
        COleClientItem* pActiveItem = 
GetDocument()->GetInPlaceActiveItem(this);
        if (pActiveItem != NULL &&
                pActiveItem->GetItemState() == 
COleClientItem::activeUIState)
        {
                // this will update the item rectangles by calling 
                //  OnGetPosRect & OnGetClipRect.
                pActiveItem->SetItemRects();
        }
}
     
void COptionsView::OnUpdate(CView* pSender, LPARAM lHint, CObject* 
pHint) 
{
     
        CListView::OnUpdate(pSender, lHint, pHint); 
     
        switch (lHint)
        {
        case HINT_UPDATE_WINDOW:    // redraw entire window
                Invalidate(FALSE);
                break;
        default:    
                break;
        };      
}
     
BOOL COptionsView::OnScrollBy(CSize sizeScroll, BOOL bDoScroll) 
{
     
        // return CListView::OnScrollBy(sizeScroll, bDoScroll); 
        // do the scroll
        if (!CListView::OnScrollBy(sizeScroll, bDoScroll))
                return FALSE;
     
        // update the position of any in-place active item 
        if (bDoScroll)
        {
                UpdateActiveItem();
                UpdateWindow();
        }
        return TRUE;
}



jmitchell@derwent.co.uk
Friday, December 13, 1996

     
     I had the same problem. What you need to do is override 
     COleServerDoc::CreateInPlaceFrame and inside there set the parent of 
     your splitter window that is in your CMainFrame to the COleIPFrameWnd 
     that you create.
     
     Justin Mitchell
     




| Вернуться в корень Архива |