Can not add item to a list

I want to define the lenght of a list by press X times the button. I create a legend just to show the length of the list in real time but it is not working.
Anyone can help?
mit

You will need to add empty items to the list to do that:

image

This will add an empty item to the end of the list.

If you want to position the empty item, then use this block

image

(but the preceding index value must exist, that is, you cannot insert a list item to index 4 if the length of list is 2)

Thanks for helping, but the set label must be on the screen block.
So the question is how to pass the variable from the button to the screen block?

You can set that label block in Screen initialise as well. Your list will be empty, on initialise, unless you populate it...

Can you shown me?

I will populate it by clicking the button

I have. Try my blocks...

Do you know why you are doing this?

For a memory game, to see the history of button clicking. I need to know the order of witch button have been clicked

Ah, so you want to store the button in the list. This will be OK if you do not want the data to be persistent. Buttons are generated at runtime with different underlying names.

You can setup a list of pairs to help identify which button was clicked, to overcome the above. If I get time I can put together an example for you...

your block does not work

Perhaps like this?

recordButtons.aia (2.3 KB)

If you really want the actual button (at runtime) then you can get it like so:

image

but this will only be valid with the current session of the app, the button name will change if you restart.

Thanks!!!