Is there any way to making button list without dragging?

image

I have many buttons, color1,2,3....color30 (maybe more) and make buttons list.
I was wondering is there a way to make simple code for making many button list.

I tried this but I don't think this works. I tried get specific buttons from everybuttons with their height and width.
image

You are adding items to a list that already contains those items...

Use the anyButton components with the everyButton block

2 Likes

Does that mean I have to drag and drop for making the list of 30 buttons? Is there a way to make it simple using a function?

No
The every Button block already is a list of all your buttons

Taifun

1 Like

Initialize a new variable as list, pick the button you want from every button list and add it to the new variable.

1 Like

I've tried this, but it doesn't work. I don't know which part is wrong.

Are you sure the button height is exactly 10?

Are these 10 buttons in a seperate container than others? If yes, you can use my extension CompCreator. Search it for the link by yourself.

1 Like

Only using number cause problem. Using textcolor works fine.
I don't know why.

button_test.aia (3.0 KB)

This is why...

image

You may need a range (28<buttonheight>32), as long as your button heights are significantly different

1 Like

image

Can someone tell me why it is different from the height set in the designer session?

It seems to depend on which display settings were chosen:

With some settings I also get Button.Hight = 29, with others I get 30.

Try something like this:

1 Like

If you have well named components, you can typeblock component name fragments, like in this sample:

1 Like

Or you only have to drag one and copy that and change the name in the dropdown menu using add item to list blocks.

1 Like

A nice example how NOT to do it...

Why?
DRY - Don't repeat yourself

Taifun

Yes, unless you need a specific order, and I have 10-12 virtual screen and 150+ arrangements and canvases in that app. And I did not need all of them in the lists. Of course I could add all aof them to the lists and ignore the ones i do not need, etc...
Not to mention the workarounds caused by plenty of bugs in the AI2. So. Usually you are right, but...