Problem with Web Browser Control on a CFrameWnd
Ramon J. Garcia -- ramon.garcia@protec.es
Monday, March 24, 1997
Environment: Win 95, VC++ 4.2b w/ Cross Compiler 4.0b
I have a problem with the Microsoft Web Browser Control: if I put it on a
resizable dialog all works fine, but if I put it on a dialog associated
with a CFormView and I try to resize the view with the mouse browser
scrollbars don4t refresh properly. It seems like if it repaints the
scrollbars, but next, something happens that make them dissappear. I've
tried to investigate
through MFC source code to see what could be happening, but I didn4t
succeded.
Below is an extract of my code, my frame-window class is a simple
CMDIChildWnd.
void CMyFormView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// Show the page
m_web.Navigate(((CMyHtmlDocument *)GetDocument())->GetFilename(), 0, 0, 0,
0);
// Resize the frame
GetParentFrame()->RecalcLayout(TRUE);
ResizeParentToFit(FALSE);
}
void CMyFormView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
// Resize WebControl
if (m_web.GetSafeHwnd())
{
m_web.SetWidth(cx-40);
m_web.SetHeight(cy-40);
}
}
I've looked through Microsoft Knowledge Base and MSDN for a sample. The
former has one called IEZOOM.EXE (Article ID: Q156693), a SDI application
based on CFormView, but it doesn4t work properly.
Is this a MFC bug? or, is there a trick to resize this control?
Any help would be appreciate!
Thank you for your help.
+--------------------------------+--------------------------------+
| Ramon J. Garcia | PROTEC, S.A. |
| Development Department | Dr. Esquerdo, 66 |
| | 28007 Madrid, Spain |
| | Tlf: +34 1 573 08 08 |
| | Fax: +34 1 574 88 39 |
| E-mail: Ramon.Garcia@protec.es | http://www.protec.es |
+--------------------------------+--------------------------------+
Philip T. Carey -- ptcarey@netcom.com
Tuesday, March 25, 1997
[Mini-digest: 3 responses]
I have found that if you trigger a timer as the last task in your
OnUpdate code, and then respond to that timer with your call to
Navigate, that the refresh problem is solved. Although this is
definitely strange and seems unnecessarily complex, it does seem to
work. I would be interested to find a better solution too, but this
should work.
-PC
Ramon J. Garcia wrote:
>
> Environment: Win 95, VC++ 4.2b w/ Cross Compiler 4.0b
>
> I have a problem with the Microsoft Web Browser Control: if I put it on a
> resizable dialog all works fine, but if I put it on a dialog associated
> with a CFormView and I try to resize the view with the mouse browser
> scrollbars don4t refresh properly. It seems like if it repaints the
> scrollbars, but next, something happens that make them dissappear. I've
> tried to investigate
> through MFC source code to see what could be happening, but I didn4t
> succeded.
>
> Below is an extract of my code, my frame-window class is a simple
> CMDIChildWnd.
>
> void CMyFormView::OnInitialUpdate()
> {
> CFormView::OnInitialUpdate();
>
> // Show the page
> m_web.Navigate(((CMyHtmlDocument *)GetDocument())->GetFilename(), 0, 0, 0,
> 0);
>
> // Resize the frame
> GetParentFrame()->RecalcLayout(TRUE);
> ResizeParentToFit(FALSE);
> }
>
> void CMyFormView::OnSize(UINT nType, int cx, int cy)
> {
> CFormView::OnSize(nType, cx, cy);
>
> // Resize WebControl
> if (m_web.GetSafeHwnd())
> {
> m_web.SetWidth(cx-40);
> m_web.SetHeight(cy-40);
> }
> }
>
> I've looked through Microsoft Knowledge Base and MSDN for a sample. The
> former has one called IEZOOM.EXE (Article ID: Q156693), a SDI application
> based on CFormView, but it doesn4t work properly.
>
> Is this a MFC bug? or, is there a trick to resize this control?
>
> Any help would be appreciate!
>
> Thank you for your help.
>
> +--------------------------------+--------------------------------+
> | Ramon J. Garcia | PROTEC, S.A. |
> | Development Department | Dr. Esquerdo, 66 |
> | | 28007 Madrid, Spain |
> | | Tlf: +34 1 573 08 08 |
> | | Fax: +34 1 574 88 39 |
> | E-mail: Ramon.Garcia@protec.es | http://www.protec.es |
> +--------------------------------+--------------------------------+
-----From: "Ramon J. Garcia"
Environment: Win 95, VC++ 4.2b w/ Cross Compiler 4.0b
I have a problem with the Microsoft Web Browser Control: if I put it on a
resizable dialog all works fine, but if I put it on a dialog associated
with a CFormView and I try to resize the view with the mouse browser
scrollbars don4t refresh properly. It seems like if it repaints the
scrollbars, but next, something happens that make them dissappear. I've
tried to investigate
through MFC source code to see what could be happening, but I didn4t
succeded.
Below is an extract of my code, my frame-window class is a simple
CMDIChildWnd.
void CMyFormView::OnInitialUpdate()
{
CFormView::OnInitialUpdate();
// Show the page
m_web.Navigate(((CMyHtmlDocument *)GetDocument())->GetFilename(), 0, 0, 0,
0);
// Resize the frame
GetParentFrame()->RecalcLayout(TRUE);
ResizeParentToFit(FALSE);
}
void CMyFormView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
// Resize WebControl
if (m_web.GetSafeHwnd())
{
m_web.SetWidth(cx-40);
m_web.SetHeight(cy-40);
}
}
I've looked through Microsoft Knowledge Base and MSDN for a sample. The
former has one called IEZOOM.EXE (Article ID: Q156693), a SDI application
based on CFormView, but it doesn4t work properly.
Is this a MFC bug? or, is there a trick to resize this control?
Any help would be appreciate!
Thank you for your help.
+--------------------------------+--------------------------------+
| Ramon J. Garcia | PROTEC, S.A. |
| Development Department | Dr. Esquerdo, 66 |
| | 28007 Madrid, Spain |
| | Tlf: +34 1 573 08 08 |
| | Fax: +34 1 574 88 39 |
| E-mail: Ramon.Garcia@protec.es | http://www.protec.es |
+--------------------------------+--------------------------------+
-----From: "Eric Rosenquist"
On 24 Mar 97 at 10:46, Ramon J. Garcia wrote:
> Environment: Win 95, VC++ 4.2b w/ Cross Compiler 4.0b
>
> I have a problem with the Microsoft Web Browser Control: if I put it on a
> resizable dialog all works fine, but if I put it on a dialog associated
> with a CFormView and I try to resize the view with the mouse browser
> scrollbars don4t refresh properly. It seems like if it repaints the
> scrollbars, but next, something happens that make them dissappear. I've
> tried to investigate
> through MFC source code to see what could be happening, but I didn4t
> succeded.
I found I had to set the CLIPCHILDREN style for the dialog that the
CFormView is based on.
> void CMyFormView::OnSize(UINT nType, int cx, int cy)
> {
> CFormView::OnSize(nType, cx, cy);
>
> // Resize WebControl
> if (m_web.GetSafeHwnd())
> {
> m_web.SetWidth(cx-40);
> m_web.SetHeight(cy-40);
> }
> }
>
> Is this a MFC bug? or, is there a trick to resize this control?
This seems to work fine for me:
void CMyFormView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
// Resize WebControl
if (m_web.GetSafeHwnd()) {
m_web.MoveWindow(0, 0, cx, cy);
}
}
I'm using MoveWindow to move the control's child window rather than
the SetWidth/SetHeight defined by the control. I'm not sure what they'd
do in this environment.
One other thing I noticed was that I had to set the focus to the control
in my view's OnActivateView() if my view was becoming the active one.
Otherwise it would stop responding to mouse and keyboard actions.
Eric
---------------------------------------------------------------------
Eric Rosenquist, Strata Software Limited http://www.strataware.com/
mailto:rosenqui@strataware.com Tel: 613-591-1922 Fax: 613-591-3485
Quote: Who would have guessed reading and writing would pay off!
-- Homer Simpson
---------------------------------------------------------------------
Peter A. Vanvliet -- pvanvlie@neosoft.com
Thursday, April 03, 1997
Here's the solution that works for me.
void CWWWView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
if (m_bCreated)
{
SetRedraw(FALSE);
m_Browser.MoveWindow(0, 0, cx, cy);
SetRedraw(TRUE);
RedrawWindow(0, 0, RDW_INVALIDATE | RDW_UPDATENOW | RDW_ALLCHILDREN
|RDW_NOERASE);
}
}
-------------------------------------------------------------------------
On Mon, 24 Mar 1997 10:46:25 +0100 Ramon J. Garcia
wrote:
Environment: Win 95, VC++ 4.2b w/ Cross Compiler 4.0b
I have a problem with the Microsoft Web Browser Control: if I put it on a
resizable dialog all works fine, but if I put it on a dialog associated
with a CFormView and I try to resize the view with the mouse browser
scrollbars don4t refresh properly. It seems like if it repaints the
scrollbars, but next, something happens that make them dissappear. I've
tried to investigate
through MFC source code to see what could be happening, but I didn4t
succeded.
Peter.
**********************************************************
**** Peter A. Vanvliet (pvanvlie@neosoft.com) ****
**** http://www.nanocorp.com/vanvliet/peter/peter.htm ****
**** Engineering Consultant, NanoSoft Corporation ****
**** Houston, Texas ****
**********************************************************
**** Learn more about an alternative tax system ****
**** http://www.catspals.org/ ****
**********************************************************
Become an MFC-L member
| Вернуться в корень Архива
|