Any advice as how to make these blocks not as big?

Is there any way to make these blocks not as big?
One evaluates the choices made from a list picker and then decides what to do based on the choice, and the other is just the startup screen. I've used procedures where I can, but other than that, I don't know how to reduce the amount of blocks.
On the third image, I need to add two more if/else if blocks that are just as big to the whenScreen1.initialise event handler.:thinking:

Aia file-Browser2.aia (66.2 KB)

Note- this is a work in progress

You did not show any of your specific color procedures.

I suspect each is a copy of each other, differing only in some values that should have been looked up in a table keyed by mode.

Even this little optimization is nothing compared to the required table technique...

You are fluffed up by a factor of at least 30.

Here is a color lookup table you can load from Media at startup ...

All those color procedures should be combined into a single procedure, parametrized with the mode name.
The mode setter should look up the colors from a mode table and set the components.

You might need one or two extra procedures, depending on the scope of the effects, like a background setter procedure that takes the mode name or background color name as a parameter.

That should completely eliminate those combs of procedure calls, replacing them with single procedure calls providing the required background theme or mode name.


Thanks @ABG. I'll mess around with this to see how it works. I'll repost the .aia when I've figured out how to use the provided code in from the link. Still kinda a newb with app inventor, although I've come very far.

Also, when a short series of 'If Then' is required, it is not necessary to use 'Else' or 'ElseIf'.

1 Like

Thanks @ChrisWard. I will use that in later versions of this app, but for now it works... Thanks for all the advice.