Using horizontal arrangement name as a variable

I have non visible 10 horizontal arrangements (named HA1 to HA10. I an reading a list of some elements and count the number of elements in the list (i.e. 8). In this case I want to set the visible of HA 1-8 on. Can you please help?

Do with If. if list value is equal to 1 set visible ha1 If variable = 1 If variable = 2 … in other languages ​​I would take this variable and concatenate it —> set Visible ha&variable

1 Like

If you want all to set visible then use for each item block and set the list which contains horizontal arrangement and use any horizontal component block any horizontal visible to true and the component will be item in the for each item block

Thanks, Rogerio, I was looking to learn if I could use concatention (join text)… I understand from your answer that it is not really possible here.

Hanan

1 Like

Thanks Soham, sounds interesting, could you explain slowly? I am not too bright… :slight_smile:

Use the If blocks .
If value=1 set ha1.visible=true
If value=2 set ha2.visible=true
If value=3set ha3.visible=true

We don’t have the block (switch) or (do case) blocks

Use for each item block from the control section and in that the list should be the list which stores all your horizontal arrangements… Then when you click on any components section in blocks you will get ‘any horizontal arrangement’ click on it and drag a set any horizontal arrangement visible… Set the ‘to’ parameter to true and the component should be the item from the for each item block that you have placed

1 Like

Another method is by using any components.
Make a list of ha from 1 to 10 in a variable named arr or any.
Use loop from 1 to length of list arr by 1
Use set horizontal arrangement visible from any components and on arrangement option use getItem by index block and set i as index which will get from loop and arr variable and visible to true or false.
You can use if and else block like if i is less than 5 then true else false.

This is the reference but use from loop

1 Like

Thanks ShaikhSajidAli. I will do that.

Hanan

It works perfectly, thanks again!

Hanan

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