Detect Screen Resolution in Perspective

I have hidden docked windows that fly in on button press. Since Docked windows have a fixed size, is there a way to detect the resolution or aspect ratio (vertical or horizontal) and pop out a different docked view depending on the results?

I have searched for ways to get the screen resolution or window size but examples seem to be geared toward vision.

This is actually quite difficult, as browsers actively hide resolution information so that their zoom functions and accessibility hooks (screen readers, etc) work regardless what the website “wants”. The canonical way to do such things is with flex containers – not with the dock itself.

1 Like

Thanks Phil. Well sure ideally the docked view could be set to “flex”. We can make flex windows and flex containers but Docked windows are fixed. It seems like something maybe to be improved on?

I suppose I can go back to popups but they don’t flex that well that I have seen…

I can also go back to just navigating do different screens but I had the thought that docked windows (for fly in menus and such) would improve performance over slow networks as they may be preloaded then just hidden and shown when the button is pressed? The fly-in when you show and hide the dock also gives the aesthetic that most modern responsive mobile apps provide. I haven’t had a chance to test performance differences yet though.

There are a couple of limitations in Perspective’s implementation of Docked Views right now which prevent us from providing dynamically-sized Docked Views.

  1. Docked View size is not dynamic; you set the size in the GUI configuration panel and that’s the size you get when the Docked View is expanded.
  2. You can not configure the same View to be used more than once on a single side of a primary View.

What you COULD do, which is arguably even more “modern” than Docked Views, is turn your entire View into something more akin to an accordion layout (or wait for the Accordion Component sometime in 8.0.3 or 8.0.4).

It would take some clever placement of components, but if you have a Flex Container with direction set to “row”, and you place multiple Flex Containers within, then you could modify their position.display properties dynamically, resulting in the appearance of an accordion or “flipping page” layout (you just need to make sure you don’t end up in a state where none of the containers which display a handle are visible).

This avenue would play pretty nicely with smaller screens, assuming you manage the grow/shrink correctly.

4 Likes