I want to make it so that for each item in list, only once a condition has been met that it can move on to the next item.
I have it so a list contains some numbers from 0-9. For each number, the corresponding button will be highlighted yellow.
Only once the user has clicked the button should we move on to the next number in the list.
So:
Assume the numbers in the list are 2,5,6, and 9. Currently all four corresponding buttons light up yellow at the same time. It does not wait for the user to click.
I want it to be so only 2 lights up. Then when the user clicks 2 and it goes back to grey, will 5 light up. And then it keeps doing that till we get to 9.
How do I do this?
EDIT: I changed it from a For each item in list block to a while test/do block. It's essentially the same thing. I increment the index of the list by one each time the loop completes. If I leave this as is, all numbers in the list highlights. If I try to break out of the loop using the "highlight" variable, I can't get back in. So yes, only the first button gets highlighted, but that resets the whole process. BabyApp.aia (9.0 KB)
This makes them useful for temporary lists where you want to remove an item and the rest of the items in the list move up.
Make a temporary list containing just the numbers you want to be eventually yellow (2,5,6,9).
Keep a permanent list of your Button components 0-9, for use with generic Button (Any Button) blocks.
Loop over the permanent Button list by index, and use the index to decide if it matches the first item of your temporary list. (Give or take 1, if you insist on starting at 0). If the index matches that first item, highlight the button yellow, otherwise dehighlight (grey) the button.
At the end of the loop, remove item 1 from the temporary list, leaving just (5,6,9).
You did not mention when you would repeat this process with the shortened temporary list.
Add extra code at the beginning to to avoid selecting from the temporary list if it's empty.
P.S. Further help would need posting an aia export here.
(I always do a cleanup blocks to make sure I can scroll through everything.)
But I don't see where a random item name is presented to the user, to guide input checking.
So the app should provide partial feedback during code entry, digit by digit, only highlighting a button after it has been pressed in the right sequence for the displayed item name, and only highlighting one button at a time, until the last digit has been entered?
and yes im trying to see if I can create an app that helps memorize item numbers.
The way it would work is, buttons are highlighted, and only once all the numbers have been pressed will the name of the item be revealed. (there is no real purpose to this app, its just for fun. I just want to see if I can actually make it).
I haven't gotten to that part yet, I'm still trying to figure out how to get the buttons to highlight one at a time and only upon the users input. First button should be highlighted upon either screen initialization or "go" button. I'm choosing "go" for the sake of testing.
But yes, once the last digit has been pressed, the name of the item is revealed. So for "Red Cherries", buttons 2, 5, 3, and 4 would be pressed. I could make it so pressing "Enter" once no more buttons are highlighted would reveal the name, but I could also just remove that altogether.
Currently I'm testing another idea and seeing if I can remove the while loop and make it so the very first number gets highlighted upon clicking "Go" but the remaining numbers in the list get highlighted after each user's button click.