How to subtract a percentage or pixel value from [[window.height]]

I’m resizing a dynamic panel based on the height of the browser.

I’m using [[window.height]] to set the size to 100% but I need to subtract 10% from this or better yet subtract a pixel height from the [[window.height]].

Any ideas?

You can do math within the expression (between the double square brackets) like,

  • [[Window.height - (Window.height * 0.1)]] to literally subtract 10% of the value of the window height
  • Or, an equivalent but shorter expression [[Window.height * 0.9]]
  • [[Window.height - 20]] to subtract 20 pixels (as the variable, Window.height is in pixel units.)

You can also refer to a widget’s own properties with the built-in variable, [[This]] , as in [[This.height]] . Likewise, refer to another widget’s properties with “local variables”, as in [[LVAR1.height]] , where LVAR1 points to that widget.

So, if you want to set the height of your dynamic panel to half it’s current height, from this widget itself, you’d use:

Set Size of This to [[This.height / 2]]

And if you want to do it from another widget–or the page–you’d use:

Set Size of MyDynamicPanel to [[Target.height / 2]]

If you want to ensure your widget is always 10% shorter than the browser window, you can use the Window Resized event in the Page interactions (when you have no widgets selected, look at the INTERACTIONS PANE and click the New Interaction button to find this event. Window Resized is fired anytime the size of the browser window changes, including a page load. So:

Set Size of MyDynamicPanel to [[Window.height *0.9]]

And if you want it to always be 100px shorter than the window:

Set Size of MyDynamicPanel to [[Window.height - 100]]

Axure reference on Math and Expressions:


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.