Perspective: How to check if dock is already open?


How do I check if a dock is already open? I have a dock that I’m using for displaying device controls and want to toggle it open/closed if the same device is clicked, or pass new params if it’s open and another device is clicked.

Setup some flags in session area and toggle them while open and close dock


I’m just coming back to this for another project, and it would seem like I need to set these flags in the script that I open the dock with; I can’t do this on the dock View itself… I don’t like having central functionality called individually at the spokes :frowning:

Yes, this because at session startup on client every docks are loading into memory. This is why I say, don’t create a lot dock views in your projects. Instead create a dock with embedded view and pass your view path as parameters to dock when you open it.
For your need, it is best to create a new opendock function in your library and call it.

I am using the handle icon to open a dock window, how do I know if it is open or closed?

If your dock is in push mode you can check the primary view width and check if it goes lower than it should be then you know your dock is open.
For example you have dock with 100px and view with 1920px. When dock is opened the view width change to 1820px.
This is ugly solution but there is no other way til now.

Can you check the x y position of the dock? I can’t remember. checking width will only work for fixed resolution clients and will fail for any other res

No we can’t. At session startup you get the primary view width and save it in session property. After that write script change on custom property on each view, that bind to the primary view width.
If the current value is less than startup value, so we have open dock and when it is more than, we close dock event.

Ah, yes that makes more sense :+1:

I know it is crazy and messy but what choose do we have here

Hello I need to refresh the content of my docked (cover and opening from icon) whenever its opened. I tried using OnFocus event but it does not work. Any suggestions?

you are using the handle icon for toggle the docked ?