Convert Set of similar blocks to loop

I am trying to replace the blocks. They were under a timer which is always running. What I am trying to do is change the visibility of vertical arrangements using checkboxes.


Don’t mind the “!” mark in the block it is due to it is removed from timer block

The combo used , along with this is
blocks (2)
These are there for each of Vertical arrangements. Can loops be used for these?

To a loop , It is some of my old works when I wasn’t aware the loops would work here.
This is what I have tried

The problem with this is , The loop when placed under timer , it causes the selected vertical arrangement to flash for a moment and disappear.

the blocks in the blocks (2) are still there.

Thanks for help!

What I usually do:

Create a procedure that hides all the arangements (sets each arrangement visible to false)

Run that before looping over the checkboxes to find which arrangements need to be visible, and make them so…

I have made default CheckBox to false , and vertical arrangement.visible to false
So what you are telling sounds like
blocks (3)
and running


under the timer

Try this example:

checkboxArrangements.aia (2.9 KB)

(There is probably a better way but this seems to do what you want…)

You could also write the hideArrangements procedure like this:

blocks (11)

Nice shorter way!

I want to make the VerticalArrangements.Visible = false so this suits more

blocks (7) blocks (8)

Okay now I have tried placing these blocks under clock1.timer


the error lies in here itself in the index part , I cannot understand why is index coming = 0
the screen shot of error
lists are in the post before this one
Link just in case of confusion

In what way are you running it in a clock timer?

component_event
under the When Clock1.timer I am running


and
clock1.timerEnabled = true
is under screen1.initialise

P.S. Do Not worry of the cross :x: beside When Clock1.timer

according to the documentation MIT App Inventor List Blocks
the index in list block

Returns the position of the thing in the list. If not in the list, returns 0.

let me suggest to use a counter variable to increment the index...
Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Here is a sample of how to tie visibility to checkbox states .
The checkboxes control the visibility of the matching buttons, you could use arrangements instead of buttons.
all_checkboxes

Checkbox_visibility.aia (2.8 KB) when any checkbox changed
The place where you failed was where you tried to init a global variable for something dynamic instead of using a value procedure.