It is currently 6 December 2022, 20:24 Advanced search

Screenwidth not reporting in Edge

Questions and answers on how to best use Instant Developer

Screenwidth not reporting in Edge

Postby ATroyer » 9 August 2022, 12:07

I just noticed that the application.screenWidth property is reporting as 0 in the latest version of Edge. I have a form that only shows a limited number of tabs if the screenwidth <= 768. I tried both Chrome and Firefox and they work fine.

I did a quick workaround, with the criteria being that if (application.screenWidth > 0 && application.screenWidth <= 768), then hide certain tabs.
Posts: 51
Joined: 30 October 2019, 13:30

Re: Screenwidth not reporting in Edge

Postby ljwilson » 20 August 2022, 19:36

I could not reproduce this with the two Edge versions I have access to:
Version 104.0.1293.47 (Official build) (64-bit)
Version 104.0.1293.63 (Official build) (64-bit)

This is on a Windows 10 machine, using Zen. I tried Bootstrap as well, same thing.

I've attached my testing app--maybe you can see what is different.

I did notice with all browsers that the framework has to "settle-in" before the width is available. For example, clicking on the menu option to open the form always worked when the code was called in the Load Event of the form. So next I I tried showing the form in the after login event. For that case the value was zero for all browsers. If I set a one second timer to fire to show the form (with the command in a procedure that was linked to the timer) then it worked. In the end I just got rid of the load event of the form and moved the code to the form On Resize event so I could see it updated in real-time when resizing the browser window.

AppScreenWidth Example
InDe 22.0 r18 Express version
(428.32 KiB) Downloaded 22 times

Posts: 678
Joined: 26 November 2013, 14:15

Re: Screenwidth not reporting in Edge

Postby smuser » 26 September 2022, 7:45

I know that Activate is the first event which is invoked by the framework after the DOM of the form has been completely created. I suppose the ScreenWidth is valued after this event (i.e. after the client setup the window).

Activate is invoked after the Load event and everytime the form has the focus back.

Resize is invoked after the Activate event and everytime something change the size of the form (which can be the sidebar hide/unhide, a resize of the browser, a subform in a section of another form that appears, ...).

As reference see paragraph "3.4.2 Life cycle of a form" on the doc ( ... e&lang=eng)
User avatar
Posts: 247
Joined: 3 May 2019, 10:41
Location: Milano

Re: Screenwidth not reporting in Edge

Postby ljwilson » 1 October 2022, 18:49

Good stuff, thanks!

Posts: 678
Joined: 26 November 2013, 14:15

Return to Tips & Tricks

Who is online

Users browsing this forum: No registered users and 2 guests