Auto adjust widget height base on variable

Hello :slight_smile:
Hope some can cast a light on this problem, am currently facing.
I want when one click on one screen it set a variable with value ex 5, 10 , 15, 20 and open a new screen 2 and then adjust a widget height base on that height, let’s say you click on the 10, it will but my widget (rectangle) at 30 px H and at 50 if it was 20 the value was. I have tried to make it more clear with a image of what i wanted. test

If I understand you correctly, you want to set the y-height of one shape to that of another onClick (I’ll assume the “new screen” is a different state of a dynamic panel for the moment).

Is that right?

1 Like

Hello JonB :smiley:
Thanks for your reply, and yep that is exactly the thing I wanted!
I guess i need some Javascript somewhere to change it? Or perhaps you can make it works by the function in axure?

If you make the OnClick event on the Screen 1 widget do a “Set size” action on the Screen 2 widget, then in the Height field of the “Set size” dialogue put [[This.height]] rather than a number, then that should do it I think (because “this” refers to the height of the Screen 1 widget in your diagram).

1 Like

Hi PeterHW,

Thanks for posting in the Axure Forums! You can use the “Set Size” action to directly change the size of the height of the widget. You can also add a “Set Panel State” action to change your dynamic panel state and show the newly sized widget. To help you set this up, I have attached an example of an interaction like this.

Example.rp (54.2 KB)

Please let me know if you would rather have your interaction set a variable value, and then use that variable to set the height of the widget, and I would be happy to provide an example.

I hope this helps!

Best,
Ashley

1 Like

From what I understand, a variable wouldn’t be needed in this case. It’s simply a size change and a panel transition.

2 Likes

Thanks @Ashley_Axure and @JonB That worked as i wanted! :smiley:
Many thanks for the help and solutions, which one sould i put as a answer? - As both of your answer helped me :smiley: