browser width a startup

I am being messed with the xojo behaviour addressing browser width issue.

Inconsistent width detection whenever I open the first web page of my application. Sometimes, it detects the browser width but sometimes it detects the initial width of my webform.

Anybody can share some technique or solution on getting the width of the browser. Please.

First resize event at opening of the page gives you the design width. Second resize event gives you the actual width.

Usually, getting WebPage.Width in Shown works fine.

Hi Michel,

[quote]First resize event at opening of the page gives you the design width. Second resize event gives you the actual width.

[/quote]

You mean, RESIZE events is triggered twice when opening the page?

Yes.

Thank Michel!

I’m using 2016 r2.1

The SHOW event always return the width inconsistently. Sometimes it returns the page from the design form sometimes it shows the width of the browser.

The RESIZE event returns the width of the browser correctly.

To simulate what you had mentioned, I created an application with only 1 webpage. I created an app.property default value is 0 as the counter to be used in PAGE RESIZE.
The RESIZE event count it and the result it always 1.

I don’t know how to simulate your findings that RESIZE is triggered twice.

Apparently, with 2016R3 under macOS Sierra in Chrome, I get the exact width.

I do remember encountering the peculiarity you mention, though, when I was developing RubberViews.

You have no code that goes as something like

self.width = 800

do you ? That could throw off the width reading.

If nothing works, you can use an executeJavaScript or a WebSDK control TriggerServerEvent() to get

window.innerWidth

https://www.w3schools.com/jsref/obj_window.asp

[quote=318473:@ronaldo florendo]Thank Michel!

I’m using 2016 r2.1

The SHOW event always return the width inconsistently. Sometimes it returns the page from the design form sometimes it shows the width of the browser.

The RESIZE event returns the width of the browser correctly.

To simulate what you had mentioned, I created an application with only 1 webpage. I created an app.property default value is 0 as the counter to be used in PAGE RESIZE.
The RESIZE event count it and the result it always 1.

I don’t know how to simulate your findings that RESIZE is triggered twice.[/quote]

I too have observed massive inconsistencies with page size reporting, especially when reloading the page. Sometimes its design size, sometimes it’s the correct size and sometimes it will give me the wrong size but never give me a resize event to get the correct size.

I made an example file and submitted a bug report for this. More info here:

https://forum.xojo.com/37430-46463-webcontrol-width-with-left-and-right-anchors-set-not-corr/

Thanks Hal.

Let’s wait for the update.