Change dock placement depending on screen height

Hi,

On smartphone, my taskbar is good in portrait but too large in landscape.
Is it possible to deplace bottom dock to the right depending on my screen height ?


If you are on 8.1.19 or higher, you shoul be able to do this with
system.perspective.alterDock - Ignition User Manual 8.1 - Ignition Documentation (inductiveautomation.com)

2 Likes

The alterDock function is indeed the place to do this, but be warned that the modifications there are on a per-page basis; navigating to a different page will put your Docked View back to the bottom (assuming it is a shared Docked View).

You might want to look into the Auto Breakpoint setting available for Docked Views. Unfortunately, I believe the setting works in the opposite direction of what you're looking for... The current implementation makes a check against the width of the browser viewport and makes the Docked View "collapse" if smaller than the applied setting value.

I think the following setup might work:

  1. Apply your Docked View (DV) to both sides of the Page and supply each with a unique ID ("taskbar_left"/"taskbar_bottom").
  2. For the DV on the left, use Auto Breakpoint to specify the width of the Page which dictates when the DV should be removed.
  3. Within the View in use for the DV, place a new custom property bottom_should_be_expanded.
  4. Bind bottom_should_be_expanded to an Expression: {page.props.dimensions.viewport.width} < {page.props.dimensions.viewport.height}
  5. Add a change script to this bottom_should_be_expanded:
# untested code
dock_to_expand = "taskbar_bottom" if currentValue and currentValue.value else "taskbar_left"
dock_to_collapse = "taskbar_left" if if currentValue and currentValue.value else "taskbar_bottom"
system.perspective.closeDock(id=dock_to_collapse)
system.perspective.openDock(id=dock_to_expand)

That script will run twice (because it lives in both Docked Views attached to the page), but they'll both be doing the exact same thing.

2 Likes