How to parameterize a menu

Hi, I need to parameterize a menu.
I have a menu made up of 30 buttons arranged in a grid of 3 columns and 10 rows.
From an Airtable table I read the records, with the characteristics of each button, in a List variable (ListMenu).
Now I would like to associate the values ​​corresponding to the index of the variable to each button.
The buttons are named Button1, Button2, Button3, … Button30.
Basically I would like to be able to associate the suffix of the name (1,2,3,…,30) with the index.
Button1 → ListMenu[1],
Button2 → Listmenu[2] etc…
which I normally do with other languages. How can I do?
Thank you

Use data viewer.

1 Like

Hi, first of all thank you for your input. I’ve already done a test. But it allows me to insert only two buttons per row and in the properties I don’t see how three can be inserted. Is it possible to change the layout of the Data Grid?
Thank you!

Hello everyone, I am making a scrolling menu consisting of thirty buttons arranged in ten rows. From Airtable I read the characteristics to associate with each button and save them in some lists.
What I want to achieve is something similar to a Data Viewer Grid (I don’t want to use DVG because it only shows 2 buttons per row).
I have implemented everything but now I have the problem of how to intercept the button pressed.
With “AnyButton.Click” I intercept the button and I can change some of its properties but I would need to know its index in the sequence or its name from which I could get the index (the names of the buttons are: B1,B2,B3…, B30 and so knowing the names I could derive the index).
I could associate, in order, a text with the sequential number to each button. Then with “AnyButton.Click” I read the text of the button pressed and then derive the index. That should work. But is there a more elegant way to derive the index or name of the button pressed?
Or some other idea to achieve this?
Thanks

Here’s are two ways to find out which button was pressed:

Note that where it says “Which button clicked for…” you would select the container name (in this case, I’m using the screen as the container but it could also be a group, row, or column).

Demo: Thunkable

(See the first screen in that project)

1 Like

Thank you tatiang! I had managed with a trick to solve the problem by putting a (transparent) text on each button

but your solution seems better. However, I have to put all the affected buttons in one container and pay attention to the others that have to follow other paths…
Thanks again!

1 Like

In the same way, could I also upload images to the buttons by taking them from a List?
I tried this way:

but nothing comes out…
Thank you.

Yes, I think that should work. How do you have the images stored in app variable MenuIcone? Are they urls?

Try this: replace the in list block with a text string to a known working image such as “https://icons.iconarchive.com/icons/thesquid.ink/free-flat-sample/1024/owl-icon.png”. So you’re testing to see if the loop will set all button’s background pictures to that. If that works, then you know the problem is with your list items. If that doesn’t work, then the problem is with your loop but I’m not sure why that would be.

The images are stored in a table on Airtable. Each record is an item in a menu and the icon is stored in a field as an attachment. I read the images in the List variable MenuIcons the same way I read other data. All other data I see them correctly. Thanks for your help.

It’s very possible this is affecting your project: Changes to Airtable's attachment URLs 11/8/22.

But you didn’t say if the known working image url I posted above works with your blocks. Does it?

Yes, the url works. The problem is in the loop. I had already done this test by setting the individual buttons with list elements as you see in this image:

I managed to solve the problem, however, by observing that the index in the loop is not the numeric progressive but the object key…
So by introducing a numeric index into the loop this points to the list element.
I post the solution. It might be useful to someone.

Thank you for your time. :wave:

2 Likes

Ah yes, sorry I didn’t catch that. It seems clear now that you posted the solution… you can’t use j as the index since it’s a button object.

Good solution!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.