Can I make a List or Dictionary of Procedures

Wondering if I can create a List of Procedure or Dictionary of Procedures?

Why don't you try it out and see what the effect will be? By looking at your blocks, I think you can do it better with fewer blocks. Show one of these procedures.

Hello Naji

Why do you have individual procedures for the task their names suggest? What are the Columns and Rows they goto? A collection of Labels/Textboxes? It might be the case that there are easier ways to accomplish your design that you do not know of..... :thinking:

blocks (2)

All procedures differ in letter? In this case, "G"?

Look this:

By seeing more of your blocks and knowing what you want to do, I think everything can be simplified even further.

No.

You can make lists of data that can be used to feed a common procedure,
like you can make player piano rolls to feed a player piano.

Thank you guys for the quick response.

I ended going with the following approach. I will optimize the code once I have things working...

You may find when you initialise that variable, that it runs all the procedures.....

In this case, that is harmless, because they are all value procedures that generate unprintable text values, without side effects.

This is interesting... :joy:

I have seen this code before.

The OP is generating low hex value data strings to send to a device, and
they are too low to be stored directly in text blocks. (They poison the block storage and loading process in AI2.)

So they are generated procedurally at run time.

1 Like

I think App Inventor is being enhanced to work with non-printable characters?

1 Like

I have used escape characters like "\r\n"

Hi Luis

App Inventor "knows" \n and it's equivalent for HTML <br>. It probably is OK therefore with line-feed and carriage return characters too but I have never put those to the test. Some devices, especially engineering devices, use non-printing characters such as SOH, STX, ESC and so on. They are the ones that can cripple a Project and even lock-up App Inventor's Backpack. It's surprising that these issues have only recently come to light and I think that is because there are now more commercial users of App Inventor than before.

About this: would a direct TCP connection with a device be possible? I am thinking of communication MODBUS, FINS or directly a direct protocol with a server.

I just did tests with a pure TCP server that I had done, through WebServer, but obviously, the thing has not worked.

There are four TCP extensions available:
https://puravidaapps.com/extensions.php

1 Like

Regarding the initial query in the title, that is not possible at this time. @Franklyn_A_Turbak has done some work in this direction to make procedures first class citizens of App Inventor and may have some additional thoughts.