Delay in displaying items from list

I want to display each item of a list in a label/text field with a specific time of delay (1 second or more) between each item. I have tried to put the "for each item" in a Clock timer block but that does not work. Is there a way to do that?
Here are my blocks so far.
blocks (1)

Show your relevant blocks

Here is one way, there will be others

You need to use the list copy block to grab a temporary copy of the list.

In your Clock Timer check if the temp list is empty.

If empty, stop the timer.
Else set label.text to select item 1,then remove item 1

Thanks for your quick reply.
I'm just a beginner with App Inventor so I'm not just understanding all of your example.
Here are my blocks.
It's very simple: there's a list and there's a label.
I want to show each item of the list in the label-text at a specific time-interval.
Can you help me with an simple example?
blocks (1)

Ah, just one label ?

Yes just one label.
Every item in that label is replaced by the next item of the list.
That's the idea.

Thanks for your reply.
I tried your answer and it works well.
I only get an warning in the copy list block.
Maybe I don't understand the use of "copy list" completely and am I doing something wrong.
Couldn't find anything in the documentation how to use it exactly.
Can you see the error in my blocks?
Here is my block.

You cannot initialize a variable with a value using another variable. Set this value in the Screen.Initialize event instead.

first global variable should initialize with make empty list, then initialize in screen1...!

Do the list copy in the Button Click event.

That's where the action starts for this app.

Leave the Screen initialization value at create empty list just as a reminder to whoever reads the code that it should be a list.

By the way, get rid of that global length variable.
Just evaluate length of list(the copy) when you need it.

Global variables are a burden and a commitment, to be avoided if possible.
They are needed to talk across events and to hold structures in memory, but there is a cost
of complexity to keep them up to date.

1 Like

Thanks for your comments.
They helped a lot.
I have a working model now.
But there's always place for improvement.
If you have suggestions, please do.
See my blocks.

Thanks.
I got rid of the global length variable.
But I don't understand the sentence : "Leave the Screen initialization value at create empty list just as a reminder to whoever reads the code that it should be a list."
What is it what you want me to do exactly?
My new blocks here.

That's perfect.

If it bothers you to have that Clock Timer remaining running after it runs out of words to display, you could add an Else clause to the if/then test on the list length where you could disable that Clock.

That depends on what else you have going on for that Clock component.

You could also consider what to display in that Label after you have shown the last word.

Leave the last word up there forever, or clear it after the next clock cycle?

Thank you for your advice.
Are there more possibilities to do this?
Because I can imagine that when I replace the list for a file or dbase with thousands of words, copying that each time would take too long.

An in-memory copy of a list is milliseconds at most.

But you asked to display the words, once per clock cycle, and now it might take too long?

No I only was concerned that the loading of the list might take too long when the list is very big once the program is started.
Thanks for the help.

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