webpage.width not apparently reporting correctly

I’m running into a very strange seemingly random problem. The width of my webpage sometimes reports the actual width and other times reports the original width of the page that I set in the IDE. In the shown event, I have:

dim tmp1 as integer=self.width

My browser is 1600 pixels wide and breaking on this line, sometimes width is 1600 and sometimes 950 (the width in the IDE). I can run the app in one tab and have it show as 1600 then copy the address into another tab and it will show as 950. The actual page and all the controls on the page resize properly. It’s just the reported width which is wrong. Am I doing something wrong here?

You are using the wrong event WebPage.Shown to get the size. Use WebPage.Resized for that.

when reading the width of the webpage without the user having resized the browser window manually before, you may run into this: <https://xojo.com/issue/46463> To my experience even the framework itself can get confused by this resulting in locks not working properly and most importantly, coordinates of mouse events being offset.

As far as I understand the OP it is not about the user resizing the window, but about the size when the page is shown. After the event “Shown” the event “Resized” is called automatically. Then you should get reliable size information after a web page shows for the first time.

It is rather tricky anyway. For RubberViewsWE I had to dance around the framework idiosyncrasies. When a webpage is displayed, the very first resize seems to always report the design size. Subsequent resizes do report the correct values.

Alternatively, one can get window.InnerWidth and window.innerHeight in JavaScript https://www.w3schools.com/jsref/prop_win_innerheight.asp

There’s a solution, it was made by Anthony.

Where we can find that solution ?

He’s the one who created the Graffiti Suite. His name is Anthony.

@Greg O’Lone just fixed that bug, according to <https://xojo.com/issue/46463>. :slight_smile:

He is using JavaScript InnerWidth, just like me in RubberViewsWE.

Greg’s fix to <https://xojo.com/issue/46463> has been verified to work by the testing staff! :slight_smile:

Will the fix be released with 2017R2?