Webpage only showing Design time sizes

I have a web page which I’m embedding a container on at run time.

When I’m embedding the container using EmbedWithin, I’m using the webpage width and height values (with a bit of a margin etc). However the webpage size has started reporting it’s width and height as the design time sizes not the actual sizes.

I’m setting the embedded containers lock left, right, top and bottom and the embedded container resizes to the actual page sizes but when I want to do a bit of manually resizing on other controls, both the page and the embedded container still report the webpage’s design time width and height.

This was working as expected but has stopped and I have no idea what has set it off and now I’m stuck.

Does anyone have any ideas?

Thanks in advance.

Jim Brock

Sorry I can’t help, but I am seeing the same thing. I have tried to resize all ways to no avail.

Please file a bug report with a sample project.

Could it be that you are getting the page size in the page open event? I’m seeing design time size there, but correct size in the shown event. Have a look at https://dl.dropboxusercontent.com/u/18858366/pagesize.xojo_binary_project

That’s not a bug per se. In the open event, nothing has been sent to the browser yet, so the framework doesn’t know what the dimensions will be.

I always thought it was expected behavior, I just wondered if the OP was getting his size too soon.

I’m trying to get the size of the Page which has been resized and shown. I’m trying to use the size of the page to resize other objects.

The problem is, this doesn’t happen if you have a simple project and I don’t know what sets it off so difficult to create a sample project! I was hoping for some insight.

Thanks anyway

Did you download & look at my project link? It’s a simple project that shows the size of the page in both the Open & Shown events.

Or are you looking to resize your objects after the browser window has been resized by the user? In which case you’ll need to add a resized event to your webpage.

Hi Wayne,

It’s not about the events. The main page resizes to the browser and the user starts using the app. So minutes go by! Then they click a button and I want to resize a control. But the page size is being reported as the design time size not it’s actual size.

Hope that clarifies things

Thanks

Jim

Strange. I just placed this in the WebPage.Resize :

Label1.text = str(self.width)+" "+str(self.Height)

I get the browser’s window size. Not the original 600x400 design size.

But when the same code is placed in the container resized event, it reports very strange values, neither the actual size of the instance, nor the size of the container, and certainly not the size of the web page.

The best workaround I can think of is to set properties on the web page like myWidth and myHeight you update in WebPage.Resize, so you have the right values from within the container.

Thanks Michel,

I’ve just tried that and the page resize event does give the correct sizes. I will do as you suggest.

Thanks again

Jim

Sounds like a bug that should be reported or an oddity that should be documented.

[quote=161574:@Michel Bujardet]Strange. I just placed this in the WebPage.Resize :

Label1.text = str(self.width)+" "+str(self.Height)

I get the browser’s window size. Not the original 600x400 design size.

But when the same code is placed in the container resized event, it reports very strange values, neither the actual size of the instance, nor the size of the container, and certainly not the size of the web page.

The best workaround I can think of is to set properties on the web page like myWidth and myHeight you update in WebPage.Resize, so you have the right values from within the container.[/quote]
Please file a bug report about that.

I reported the bug.

I had forgotten this issue I made the bug report <https://xojo.com/issue/37862> for, and today, tried to get the size of the browser from within a web container ; Boom. The browser window was over 2000 wide, while my poor iMac 2011 cannot display more than 1920 :wink:

This one has reared its head again and I’ve managed to reproduce it in a test app. So, I’ve raised a new bug report.

<https://xojo.com/issue/45759>

Anyone got any suggestions for a workaround?

Thanks in advance

Yep. innerWidth and innerHeight properties in JavaScript.

http://www.w3schools.com/jsref/prop_win_innerheight.asp

Would you please tell me where I can find info on running JavaScript in the Xojo Doc. I’ve search the Doc. Search just does not work for me anymore.

http://documentation.xojo.com/index.php/Executejavascript

and also, see WebSDK in the Extra folder.

Thanks Michel.