Re: The mystery of landscape printing
From: Andrew Mayo (ajmayo_at_my-deja.com)
Date: 07/22/04
- Next message: Rick: "Flickering when showing full screen web browser dialog"
- Previous message: Rick: "Flickering when showing full screen web browser dialog"
- In reply to: Igor Tandetnik: "Re: The mystery of landscape printing"
- Next in thread: Igor Tandetnik: "Re: The mystery of landscape printing"
- Reply: Igor Tandetnik: "Re: The mystery of landscape printing"
- Messages sorted by: [ date ] [ thread ]
Date: 22 Jul 2004 05:44:26 -0700
"Igor Tandetnik" <itandetnik@mvps.org> wrote in message news:<ON$Sjj1bEHA.796@TK2MSFTNGP09.phx.gbl>...
> "Andrew Mayo" <ajmayo@my-deja.com> wrote in message
> news:2b20cd9f.0407210806.4d257137@posting.google.com
> > Bug of the week is
> > this...
> >
> > wbrowser.navigate <some_url>
> > set hdoc=wbrowser.document 'aarrrggh, bad bug coming up
>
> This is not a bug in IE, this is a bug in your code. Navigate method is
> asynchronous - it returns as soon as the navigation operation starts,
> but before it is complete. You only get a valid new document after
> NavigateComplete2 event fires.
>
Well, that's interesting. At first I thought 'how stupid of me to miss
that'. But when I carefully re-read the documentation I can see, on
rereading it, that you *could* maybe construe it this way but I am
guessing most people expect that once a navigate request has been
made, the document reference will be to the new document (albeit an
empty new document at this stage), which will then be populated
asynchronously. In other words we all know that the document's
CONTENTS will be asynchronously populated but I think most users of
the browser control would think that the COM reference to the document
property was valid after navigate returned, even though the actual
CONTENTS of the document have not yet been fully loaded.
(and in fact, why this wouldn't be true I can't imagine. Why on earth
Microsoft did this escapes me)
To quote from Navigate2's documentation
QUOTE
The document might still be downloading (and in the case of HTML,
images might still be downloading), but at least part of the document
has been received from the server, and the viewer for the document has
been created.
UNQUOTE
Now I would read this as saying that some HTML has now been loaded,
not that the object reference itself is not valid until this event
fires.
Nor does the documentation on the Navigate method indicate that a
subsequent reference to the document property may not be valid AT ALL
until Navigate2 fires.
Still, I'm indebted to you for pointing out this subtle issue and will
modify the code accordingly.
> > 2. Checking for document complete can be problematic. Sometimes
> > readystate transitions to "complete" early. Trapping the browser event
> > and setting a boolean on this, combined with a readystate check, often
> > helps.
>
> What again is wrong with DocumentComplete event?
>
The problem is that many applications want navigation to appear to be
synchronous, if they are loading local HTML documents, in particular,
into the browser control. Hence the spinloop. However, I have observed
that in some cases either
(a) the document transitions to 'ready' earlier than it should and
(b) the exact timing of the firing of documentcomplete appears to
sometimes occur early i.e the document is still not ready for
interaction. However, checking BOTH appears to be more reliable.
> > 4. Certain keys are trapped by the browser and (mis)handled e.g F5.
> > You can use a browser helper object to fix this (MS sample code) but
> > it will need modification if you want to use the keystrokes in your VB
> > code otherwise the accelerators will be silently eaten.
>
> Have you tried setting KeyPreview to true on your form?
Yes, of course, but this is not the problem. The inbuilt browser
accelerators can be trapped by a browser helper object e.g the sample
MS code, but are then not relayed back to VB at all, because they are
eaten. We had to create a custom modified version of the MS code to
handle this.
PS: anybody know the answer to landscape printing, btw?
- Next message: Rick: "Flickering when showing full screen web browser dialog"
- Previous message: Rick: "Flickering when showing full screen web browser dialog"
- In reply to: Igor Tandetnik: "Re: The mystery of landscape printing"
- Next in thread: Igor Tandetnik: "Re: The mystery of landscape printing"
- Reply: Igor Tandetnik: "Re: The mystery of landscape printing"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|