mansurimn / csexwb2

Automatically exported from code.google.com/p/csexwb2
0 stars 1 forks source link

Bug in DemoApp: Thumbnail not created on frameset-pages #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. go to a frameset-side like http://futurepinball.com/
2. see that the thumbnail don't get created and the progresscontrol in the 
statusbar disappears too early

What is the expected output? What do you see instead?
thumbnail gets created and statusbar is visible for every frameset.

What version of the product are you using? On what operating system?
1.0.0.3

Please provide any additional information below.
The thumbnail is only loaded when in the DocumentComplete-Event 
e.istoplevel is true. On a frameset site, it will never occur. I think you 
need a counter which counts the DocumentComplete-Events and creates the 
Thumbnail & hides the Progress when the m_curWB.getFrames.length-Value is 
reached. This would show in your demo-App how to tell when the page with 
all frames has fully loaded.

dartrax

Original issue reported on code.google.com by dart...@gmail.com on 27 Aug 2007 at 1:13

GoogleCodeExporter commented 8 years ago
Hello, I'm again...

I've tried the solution I've provided with the additional informations. It's 
also 
wrong, because if you click on a link in a frameset page which loads a new page 
in 
only one of the frames, the DocumentComplete Event will only one times fire and 
the 
m_curWB.getFrames.length-Value will never be reached.

I had another suggestion and tried it out. That was, to check every frame for 
its 
readyState property. If its "complete" (4) for every frame, the page was fully 
loaded and thumbnail could be created, I thought. But, for frames which cannot 
be 
loaded because of an error (404 etc.), it will never get "complete", which is 
not 
like IE or other browsers behave. I'm still looking for a solution on this.

Original comment by dart...@gmail.com on 28 Aug 2007 at 10:54

GoogleCodeExporter commented 8 years ago
Hi,

I tested the url and the thumbnail was created for the initial navigation.

Initial Navigation:
For every BeforeNavigate (starts with main document), a DocumentComplete will 
fire, 
the last DocumentComplete will fire for the main document which started the 
navigation. This is the case whether you have a frameset or not (look at MSDN 
webbrowser events explanation). This is why in the DocumentComplete event, I am 
checking for toplevel document which signals that the document has fully loaded 
(except for AJAX driven sites) before updating the GUI.

The DrawThumb method that is responsible to take a thumbnail image checks to 
see if 
we have a frameset, if true, then it calls DrawThumb2 method which takes a 
snapshot 
of the webbrowser visible part using it's HDC (a semi workaround).

If you read the comments in the DrawThumb method, you will notice that I have 
mentioned that DrawThumb2 method only works if the webbrowser is in front of 
the 
ZOrder and also provided a solution to deal with taking sanpshots of individual 
frames using DrawThumb if one is up to the challange.

Navigation in a framset:
IsTopLevel parameter is never true as you have discovered, but BeforeNavigate2 
and 
DocumentComplete should fire along with the progressbar being visible. To catch 
this, you need to add a bool flag to determine if DocumentCOmplete was fired by 
a 
frame navigation.

Here is one way to catch a frame navigation. I will add this to the next 
release as 
a property of the control.

Declare:
private bool m_DocDoneFully = false;

in BeforeNavigate2,

if(e.IsTopLevel) m_DocDoneFully = false;

in DocumentComplete,

If(IsTopLevel)
{
m_DocDoneFully = true;
//code ....
}
//add this here
else if(m_DocDoneFully) //indicating frame navigation
{
try
{
    ToolStripButton btn = FindTab(pWB.Name);
    if( (this.WindowState != FormWindowState.Minimized) &&
        (btn != null) )
    {
        btn.Image = pWB.DrawThumb(80, 80,
            System.Drawing.Imaging.PixelFormat.Format24bppRgb);
    }
}
catch (Exception ee2)
{
    AllForms.m_frmLog.AppendToLog(pWB.Name + "_DocumentComplete_UpdateThumb\r\n" + 
ee2.ToString());
}
finally
{
}
}

Hope this helps
MH

Original comment by mehr...@gmail.com on 28 Aug 2007 at 12:16

GoogleCodeExporter commented 8 years ago
I neglected to mention that for 404 pages, you should recive a NavigateError 
event 
which you can use in a frameset to determine if the event was fired by the main 
document or a frame.

MH

Original comment by mehr...@gmail.com on 28 Aug 2007 at 12:25

GoogleCodeExporter commented 8 years ago
Hello,

thank you for your solution. I understood and implemented it into my project. 
Generally it works. I have only one page with a Frameset and Iframes which 
contain 
Errors and JavaScript Errors, where this doesn't work: There are more 
BeforeNavigate2 Events occurring then DocumentComplete-ones! But I think this 
is 
rarely and I won't spend more time on this special case yet, but may be later.

dartrax

Original comment by dart...@gmail.com on 29 Aug 2007 at 12:08

GoogleCodeExporter commented 8 years ago
Regards

MH

Original comment by mehr...@gmail.com on 29 Aug 2007 at 11:38