Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: TWebBrowser content reloads on .Visible change


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 1 - Last Post: Sep 8, 2016 12:33 PM Last Post By: Andrew Niese
Andrew Niese

Posts: 19
Registered: 7/9/16
TWebBrowser content reloads on .Visible change  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 8, 2016 11:09 AM
I have a TWebBrowser showing Google Maps content, that is loaded by .LoadFromStrings and controlled by calling .EvalulateJavascript.

I have a TMultiView that pops out (Drawer) and shadows the rest of the form. However, the TWebBrowser as a native control stayed on top of the multiview. My solution was to do TWebBrowser.MakeScreenShot, put the Image in a TRectangle, and then hide the TWebbrowser until the TMultiView closed.

It worked great, however, changing the .Visible property of the TWebBrowser reloads the content, and resets the Google Map. So I lost all the markers, and the map location changed.

Any ideas for this? Is there a way to hide the WebBrowser while the MultiView is open, without resetting/reloading the content?

Thanks

Edited by: Andrew Niese on Sep 8, 2016 11:25 AM
Andrew Niese

Posts: 19
Registered: 7/9/16
Re: TWebBrowser content reloads on .Visible change  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Sep 8, 2016 12:33 PM   in response to: Andrew Niese in response to: Andrew Niese
It seems I fixed the problem by changing my HTML.

Before, the map was initializing like this

<body onload="initialize()">

Now I do it like this:

<body>
<script>
initialize()
</script>
</body>

Now initialize() is only called once, instead of every time TWebBrowser.Visible is changed.

Andrew Niese wrote:
I have a TWebBrowser showing Google Maps content, that is loaded by .LoadFromStrings and controlled by calling .EvalulateJavascript.

I have a TMultiView that pops out (Drawer) and shadows the rest of the form. However, the TWebBrowser as a native control stayed on top of the multiview. My solution was to do TWebBrowser.MakeScreenShot, put the Image in a TRectangle, and then hide the TWebbrowser until the TMultiView closed.

It worked great, however, changing the .Visible property of the TWebBrowser reloads the content, and resets the Google Map. So I lost all the markers, and the map location changed.

Any ideas for this? Is there a way to hide the WebBrowser while the MultiView is open, without resetting/reloading the content?

Thanks

Edited by: Andrew Niese on Sep 8, 2016 11:25 AM
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02