How do you get the max text length between or from each Label?

Show your relevant blocks so far, or at least a layout of what you are trying to achieve

I do not know what it means. Describe it in more detail.

I have only this information, because I am a beginner in mit App Inventor and I don't know with which other blocks I must combine it to reach the result....

Yes I understand yo, a pile of words and then the max out of this..... But how?

Ok... Step one : we need to make a list from every label?

A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook App Inventor 2 Book: Create Your Own Android Apps ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here Course In A Box and the aia files for the projects in the book are here: App Inventor 2 Book: Create Your Own Android Apps
How to do a lot of basic things with App Inventor are described here: How do you...? .

Also do the tutorials http://appinventor.mit.edu/explore/ai2/tutorials.html to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor

And learn how to work with lists

Taifun


Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by icon24 Taifun.

Try this simple example:

or:

Method 1 is better because it does not create a list of text that may occupy the cache, but a list of labels. Only then do we read the text from each label.

How to make a list with the" every label "block from the "any components "system ? The simplest and shortest way, if it's possible? Taaaaanks a lot :slight_smile:

Then I can look at the" sorting list method" from the tutorial to understand the system.

but first i need this every Label thing solved... and when I understand it then it make sense to try the Next step

image

get all lenghts

or get max

Ok, now I understand your approach in method 1,.. there I see for "for each block" ... Instead of the first 5 set block's , let make the "every label block" fill the list ? And a other cuestion between, is it possible to use the make list block directly in the sentence , without declaring a list name with the "set global name of the list" block?, And use it directly out of the list?

And then the max out of the textlengt numbers out of the list?,

And this then is the needed variable to work with :slight_smile:

However, this method will be good when we do not use any other labels in the application, except those in which we want to count the text length. This block returns all labels applied to the app.

Ouch, you was make the adjustments while I writing my cuestion .... WOW YOU ARE FAAAST!!!!!! YOU ARE CRAZY GOOOOOD!!!! WOOOOOW!

Ok, whery fine, now, .... Can we work directly and use the data provided by the" every label block" without the 5 first green "set label " block's?

And from this the textlengt from every label first filled in the for each label loop, and then the max textlengt out of this, excuse when I write so slow...

"However, this method will be good when we do not use any other labels in the application, except those in which we want to count the text length. This block returns all labels applied to the app."

Yes this was my question , and excuse to that my reading was slowly to, (and my understanding speed)....

Ok an then we need the max from the textlengt out of this, then I can work with this variable later on .

I understand that you want to select the longest text from the length of all labels?

Or like this

1 Like

Yes, there are many solutions, it's just a matter of the programmer's imagination. Two codes from two different programmers will never be the same.

1 Like

"I understand that you want to select the longest text from the length of all labels?"

Yessss

But the labels are present already, I need that the "for each block " works with the "every label block", take the already present label, take it's length, put it in a list, (or if it's possible without the list function) and from this take the biggest number. And put this in a variable, or a label.... That I can work with this variable ..... Excuse if my explaining sometimes are a little bit unclear, but I am in learning....

Thanks

Ok, this seems to bi the solution to get the lengt of every label, then the next step will bi load the variable /list that contains the lengths and take the biggest of them?

The next two examples do this. Just use the "every label" block instead of "make a list".