WebPage/WebContainer Height Issues

Anyone else seeing that webPage and WebContainer heights are not reporting properly? What I’m seeing is that these values do not change until the webpage has been resized an additional time.

This is a major drag on dynamic layouts as you cannot depends on the sizes returned by their Height.

I had to contend with this in RubberViewsWE and it required a bit of magic.

The first Resized gives the design size. The second one gives the actual size of the browser/device. But this is always the case, so you can count on it.

This is valid for both WebPages and WebContainers.

Right, but I’m not getting a second resize if the user never resizes the browser window

In RubberViewsWE I use JavaScript to get these values.

Does your JavaScript fix work with WebDialogs? And could you share?

WebDialogs are difficult beasts. Palette works very nicely like a window, and is pretty fair.

Sheet and Modal are in fact composed of two divs : the grey overlay, and the dialog itself So to get the proper size you got to get the size in JavaScript.

http://www.w3schools.com/jsref/met_document_getelementbyid.asp
plus object.style.width and object.style.height

Use the browser developer tools to see the structure of the dialog.

I am having the same problem on a web page. I am only getting the width property at design time rather than at run time once my browser has resized. I have tried rubberviews but that hasn’t resolved the problem either

Is this the same issue as this bug report?
https://forum.xojo.com/37430-46463-webcontrol-width-with-left-and-right-anchors-set-not-corr

I have a web container on a web page that has contained items added at run time. When I add the control with embedwith the only width parameter I can pass seems to be the design time width. If I physically resize the browser and the resize event is called I will get the correct width. Can I call the resize event manually ?

Hi Paul,

we had the same wish. :slight_smile:
Unfortunately, it seems nobody has done it yet.

I just encountered the same issue with container and wrong page size at the first time you show the page, but only on android phone. As workaround you can add the following JS in the ‘Open’ event of the WebPage:

Self.ExecuteJavaScript("window.onresize();")

This trigger a ‘Resized’ event of the WebPage which return the right size and solved the problem for me.

As you mention RubberViewsWE, there is a problem that I could not overcome. When a page scrolls, there is no way to get the height of the browser. Neither in Xojo, nor in JavaScript. I spent quite a while turning around that one. I believe this is a limitation of the platform.

In practice, when the height of the webpage is more than the height of the browser I get upon launch on the app, I base scaling only on the width of the browser.

Rejoice! Anthony done it!