Using Blocks in Another Way

(Yusuf Cihan) #1

Hi everyone!

I wanted to show some tips which I’m using in my projects. I hope you will like it!

Reduce Blocks - Using Boolean Values

Bad           image

Better        image


Blocks Saved - 6

Enabled, Checked etc. properties are returns and needs boolean, so you can use them in **condition statements** directly. You don't need to use "=" block.

This is not only for checkboxes and buttons. You can use that in almost every component.

Reduce Blocks - “Any Component” Block

If you need to change component’s properties at runtime, you may prefer to use “any component” block.

Let’s imagine you have 4 buttons in your app, and you want to change these button’s properties such as image, text, width . . .

And probably you will do that:


With “any component” block’s magic:


Blocks Saved (for 4 components) - 6

  • Easier to add new component to list
  • Less blocks
  • Change once, apply for all :sunglasses:

Returning the Last Item in Any/Dynamic List

Yes, this is possible with “length of list” block.

Making Formatted Countdown

If you need a countdown in your projects like “13:07 left” etc. you can use that:

To find out how much time is left, it has to be shown somewhere except the label. So I used Linear Progress.

You need to write how many seconds to finish countdown in LinearProgress’s Maximum Value and Current Progress properties.

For Clock component:

And you need to put these blocks under LinearProgress.ProgressChanged

That is all!

This is my first Guide topic, so it can be any mistakes. Sorry for now. :sweat: I will try to add more guides soon. :smiley:


The idea with bad, better, best is good.
Feel free to make more topics like that.

(Daniel) #3

Nice tips, I wanted also to make something like this, but you were first. Again, nice tips and everyone, use them

(David Ningthoujam) #4

@yusufcihan thank you very much for the tips! :hugs:

(Daniel) #5

Also, @yusufcihan can you add the returning procedures and the way we can use them to the list? They’re also very useful, but the average user doesn’t know about them.

(Drafat) #6

Thank you :iphone:

(Usha Paudel) #7

Nice tips :+1::+1::+1:.

(Abhijith) #8

The Problem with this is that It Sometimes freeze the Application other than that Awesome !

(Yusuf Cihan) #9

No, it won’t cause any freeze because this method uses built-in blocks. Also, you can find this block since MIT App Inventor.

(Abhijith) #10

But when i set kind of a Large List of Images It Freezes until everything Loads.

(Nathan) #11

I used this guide for an upcoming app of mine, and it’s amazing now thanks to you.

(Pablo Almeida) #12

Great topic. I had already thought on some of those things but others will help me a lot.

But when i set kind of a Large List of Images It Freezes until everything Loads.
I don’t know what is your project, but if you are dealing with many components may be you could create 2 blocks for this, and split the events between them.

Example: If the problem is with large images, you can use a block only to load images, so the others components won’t freeze. Then you can call a procedure to load images or something like this.

Or if you know when the images will be loaded you can resize then before it, creating smaller images to be shown. at the buttons for example.

I have an app where the users can send pictures taken with the camera. Sometimes one picture alone is 3MB, it would make my app super hiper slow since I show about 10 - 15 pictures at once. So when the user take a picture the app generates 2 pictures picture12345.jpg and picture 12345-hd.jpg and send them to the server.

The app load picture12345.jpg first and if the user click the picture it will download 12345-hd.jpg from the server in a gallery.