Property setter was expecting a button but got a string instead

Hi there! It´s my first time here. Sorry if not the right place or just asked in others topics.
When running my app it appears this error message
“Property setter was expecting a com…Button component but got a string instead”

I think i made code rightly as here

I’m using a for each loop with id as a part of my list just made above there.

Since this code is just exactly the same that i made some time before in the MIT app inventor web, where it worked well, i am quite confused

Thanks in advance for all of your answers and advice
Regards.

Change global like in the example

4 Likes

Thanks for your answer! :slightly_smiling_face: I’ll try it.
Best regards!

1 Like

I’ve just tried your suggestion, but the same error message appeared again

For me it works ok in my test.

2 Likes

May be he has more blocks with same logic that causes error.

2 Likes

It would really help if you provided a screenshot of your updated relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select “Download Blocks as Image”. You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun

Thanks lot for your answers.

My code still doesn’t work no matter what changes or tests i can do.
There is no other blocks in my code.
I made a video and took screenshots that always show the same problem as ever

As you can see, it doesn’t recognise the id in the for each loop as a part of my list, but a string (?)
So, i can’t find up the error origin.

More thanks again for your answers and advice.

Look

componten

and

Many people have this misconception. The component name isn’t the id name. Every time the component is created, it holds different id.

Therefore, you should use the component block (the light green one) instead of a string.

@dora_paz’s solution is an example.

u are putting button names in to the variable so it is not working

https://kodular-community-uploads.s3.dualstack.eu-west-1.amazonaws.com/original/3X/b/e/be90bbc8b300402c9012e738597ebf4ce0ae6564.png

u have to put the button component in variable like this

https://kodular-community-uploads.s3.dualstack.eu-west-1.amazonaws.com/original/3X/8/e/8e4eba395b36b3f33d31e6845223b3c562d87af2.png

It wooorks!! :smiley: :smiley: :clap:t2: :clap:t2:

Thanks lots!!
Solved problem!!

thanks lot!! problem is solved! :ok_hand:t2: :ok_hand:t2:

ok got it and solved problem!! lot thanks!

1 Like

then i didn’t note the (green) type of the component block
thank you lot!

1 Like

Glad to hear :smiley:

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