Attempt to get item number 0 error

Hi all,
I have a set of 25 buttons. I have 2 lists, one with the buttons and the other with the state they can be in. Buttons can be green and have a value of 1 in the status list, and others are red and have a value of 0 in the status list. These colors are assigned randomly.
If I do a DoIt on the OnOff procedure call everything is fine. But if I use the "btnInicio" button I get the following message.

I tried changing the values of 0 and 1 to the numbers 1 and 2 (to avoid the 0) or to the letters "F" and "V". Also try swapping for values of true and false and I always get the same error. I also tried to unify the lists and got other types of errors so I decided to go back to the original scheme.
My suspicion is that this problem occurs at the time of doing the replacement of values in the stateBtn list, but I don't know how to solve it.

Here are the blocks


Is that ALL your blocks?

Maybe you have a generic Any Button Click event you haven't shown us?

Yes I have. I thought it was not relevant at this time. What do I have to do?
I disabled it and now I get no error. But I will need to the any button because I need to change the state of the buttons at later stage

I will have to guess, because you did not show us the blocks.

You need to do an IS IN LIST test of the component against your list of button components.

Protect your blocks with an if/then test wrapping the generic event's blocks.
That way, it won't try to treat btnInicio as a list member.

Sample app:

Ok. I´ll try it. Thanks!!!

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