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.
TIMAI2
February 19, 2024, 2:27pm
2
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?
Taifun
February 19, 2024, 3:23pm
4
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)
TIMAI2
February 19, 2024, 4:56pm
9
This is why...
You may need a range (28<buttonheight>32
), as long as your button heights are significantly different
1 Like
Can someone tell me why it is different from the height set in the designer session?
Anke
February 19, 2024, 5:56pm
11
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
ABG
February 19, 2024, 8:44pm
12
If you have well named components, you can typeblock component name fragments, like in this sample:
This week the US news networks have been reporting on a free web game by Josh Wardle called Wordle , similar to Jotto, developed as a personal project and open for all.
His variation has:
one chance to play per day
every one shares the same daily word
words have exactly 5 letters
you get six guesses
You are told
which letters match in place (green),
which letters match out of place (yellow)
which letters don't match anywhere (dark grey).
I decided to try to replicate his app in AI2 under t…
1 Like
Usane
February 20, 2024, 12:55am
13
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
Taifun
February 20, 2024, 5:09pm
14
Usane:
drag one and copy
A nice example how NOT to do it...
Why?
DRY - Don't repeat yourself
"Don't repeat yourself" (DRY) is a principle of software development aimed at reducing repetition of information which is likely to change, replacing it with abstractions that are less likely to change, or using data normalization which avoids redundancy in the first place.
The DRY principle is stated as "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system". The principle has been formulated by Andy Hunt and Dave Thomas in their book The Pragmat...
Taifun
Usane
February 20, 2024, 7:32pm
15
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...