Examples for Every block for any component blocks

p40F5_every_button.aia (3.9 KB)

  • With every Button we avoid creating a list of buttons: make a list (Button1, Button2,...) manually.
  • Notice that the button's index is created automatically. It is not ordered.
  • Boton37 is different, due to the "notAlreadyHandled" block and having its own event: Boton37.Click
2 Likes

but you cant create a button list with a block that create 1 to 36 in one block?. for not create button for button in the list?. and call a number block using any component.

In the previous example I show two ways to create a list of buttons, with "every" and with "make a list", you can show other methods.

We could really do with an every componentName block as well (@vishwas )

You can get some semblance of control (for buttons) by returning the text value

1 Like

ahh ok i see that but i show you other method that i think so can be if its correct or no.

I think the OP is not talking about image, since this thread is open at May 2022, that time this block is not introduced.

We could really do with an every componentName block as well

100% agree with this comment. I addition to (or in place of) "componentName", I'd like to see every MIT App Inventor component have a String "tag" which could be set differently from the "componentName". Visual Basic, for example, allows components to be "tagged" differently from their name, which helps a lot when there are many of the same component and/or you want the tag to be different from, or simpler than the component name.

Visual Basic tag properly example:
https://www.vbforums.com/showthread.php?317182-Tag-property-in-VB6-0

It is not working with the" button.hight percentage"
"of component" (here I want to put the "every button" thing)
"To" (here : 90 %)

I will intitialize screen and than change the high percentage on all my buttons to a certain percentage

please provide a screenshot of your relevant blocks, so we better can understand, what you are talking about
Taifun

I don't know how to make a screenshot

Ahhh... Yess... I think this will really solving my problem.... Thanks

It would really help if you provided a screenshot of your relevant blocks, so we can see what you are trying to do, and where the problem may be.

To get an image of your blocks, right click in the Blocks Editor and select "Download Blocks as Image". You might want to use an image editor to crop etc. if required. Then post it here in the community.

Taifun


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

Yes, my Problem was that the green "every button" block don't work directly if it is putted in the place from the orange "get button" block, this might bi a bug to solve in the future or it is an idea to make the code shorter or more direkt, might this bi an idea for the developers?

There are computer languages like APL that let you input a list to an operation and see the operation apply to everything in the list.

AI2 is not one of those languages.

You have to add the loop, doing the operation one by one.

Thanks for helping me so fast ... And your solution was much shorter then my approach...

The advanced blocks have a component socket, which expects a component. This can't be a list of components, therefore

Taifun

Actually, the nb193 release included a number of list related operators that one would typically find in a functional programming language (App Inventor actually targets Scheme under the hood). However, there's a bit of finagling to be done because App Inventor forces blocks to either return values or not, whereas in Scheme technically every S-expression returns a value. You can use the map operator to apply an operation to every object:

And just discard the result.

2 Likes

I was making the loop because this i'm only must make a little changes to make it like you explaint it to me... Thanks it's really working

I was make it by your example, and it works fine... Thanks