🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.internet.web
6 messages
6 total messages Started by Serkan �zkan Sat, 02 Apr 2005 18:27
TCppWebBrowser - How to disable resizing with scripts
#1253
Author: Serkan �zkan
Date: Sat, 02 Apr 2005 18:27
9 lines
1319 bytes
Hi
I am using a TCppWebBrowser in an application and I don't want to let 
scripts resize the window.
I have a TCppWebBrowser on a TForm with Align= alClient. There is nothing 
else on the form. Everything works fine unless a javascript code in a page 
tries to resize the window. Then script code tries to resize the web browser 
and alClient also tries to resize it so the this race never ends.
How can I disable resizing of WebBrowser with scripts?
Thanks 
Re: TCppWebBrowser - How to disable resizing with scripts
#1254
Author: Hans Galema
Date: Sat, 02 Apr 2005 19:06
12 lines
1495 bytes
Serkan �zkan wrote:

> I have a TCppWebBrowser on a TForm with Align= alClient. There is nothing 
> else on the form. Everything works fine unless a javascript code in a page 
> tries to resize the window. Then script code tries to resize the web browser 
> and alClient also tries to resize it so the this race never ends.
> How can I disable resizing of WebBrowser with scripts?

Could you  please show the source for a minimal html page
with javascript that behaves like that ?

Hans.
Re: TCppWebBrowser - How to disable resizing with scripts
#1255
Author: Serkan �zkan
Date: Sat, 02 Apr 2005 19:39
20 lines
2316 bytes
Hi Hans,> Could you  please show the source for a minimal html page> with 
javascript that behaves like that ?> > Hans.****************** 
<html><head><script language="javascript" type="text/javascript">var fixedW 
= 700var fixedH = 520function fixWindowSize(){ this.resizeTo(fixedW, 
fixedH); return true;}function fixSizeOnLoad(){ var offW, offH, diffW, 
diffH; if(document.all){  offW = document.body.offsetWidth;  offH = 
document.body.offsetHeight;  window.resizeTo(fixedW, fixedH);  diffW = 
document.body.offsetWidth - offW;  diffH = document.body.offsetHeight - 
offH;  fixedW = (fixedW + ((fixedW - diffW) - offW));  fixedH = (fixedH + 
((fixedH - diffH) - offH));  fixWindowSize(); 
 this.onresize=fixWindowSize; } return true;}</script></head><body 
onLoad="fixSizeOnLoad()">Test</body></html>********************I guess the 
endless loop problem is caused by "this.onresize=fixWindowSize;" By the way 
I found this page from msdn 
http://msdn.microsoft.com/workshop/browser/hosting/reference/ifaces/IHTMLOMWindowServices/IHTMLOMWindowServices.aspwhich 
says "IHTMLOMWindowServices InterfaceAllows applications hosting the 
WebBrowser Control to intercept the window object calls moveTo, moveBy, 
resizeTo, and resizeBy for manipulating the host's window coordinates from 
Dynamic HTML (DHTML) script."But I could not find a way to implement this 
yet.Thanks 
Re: TCppWebBrowser - How to disable resizing with scripts
#1256
Author: Hans Galema
Date: Sat, 02 Apr 2005 20:31
22 lines
1638 bytes
Serkan �zkan wrote:

> <html><head><script language="javascript" type="text/javascript">var fixedW 
> = 700var fixedH = 520function fixWindowSize(){ this.resizeTo(fixedW, 
> fixedH); return true;}function fixSizeOnLoad(){ var offW, offH, diffW, 
> diffH; if(document.all){  offW = document.body.offsetWidth;  offH = 

That is unreadable!

Could you please format that and care for it that it is human readable ?

I mean:

<html>
<head>
<script language="javascript" type="text/javascript">
var fixedW = 700
....

Thank you.

Hans.
Re: TCppWebBrowser - How to disable resizing with scripts
#1257
Author: Serkan �zkan
Date: Sat, 02 Apr 2005 20:43
33 lines
2084 bytes
Sorry mail client has changed the format and I could not notice that.

****************************
<html>
<head>
<script language="javascript" type="text/javascript">
      var fixedW = 700
      var fixedH = 520
      function fixWindowSize(){
             this.resizeTo(fixedW, fixedH);
             return true;
      }
      function fixSizeOnLoad(){
             var offW, offH, diffW, diffH;
             if(document.all){
                    offW = document.body.offsetWidth;
                    offH = document.body.offsetHeight;
                    window.resizeTo(fixedW, fixedH);
                    diffW = document.body.offsetWidth - offW;
                    diffH = document.body.offsetHeight - offH;
                    fixedW = (fixedW + ((fixedW - diffW) - offW));
                    fixedH = (fixedH + ((fixedH - diffH) - offH));
                    fixWindowSize();
                    this.onresize=fixWindowSize;
             }
             return true;
      }
</script>
</head>
<body onLoad="fixSizeOnLoad()">
Test
</body>
</html>
Re: TCppWebBrowser - How to disable resizing with scripts
#1259
Author: Hans Galema
Date: Mon, 04 Apr 2005 08:23
12 lines
1374 bytes
Serkan �zkan wrote:

>                     this.onresize=fixWindowSize;

That one is the problem.

Sorry I see no possibility to suppress that.

Why don't you want to give the designer of that page
what is asked for ?

Hans.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads