Way to reduce size of code .OnClick Images

Wondering if there was a way I could reduce my code?

I have images users can click on, but 4 out of them 12 images display at a time, so i was wondering how to reduce the code if possible? Show example if can, please :slight_smile:

Yes it is possible.
Create three global variable

  1. Names of all cloud db tags
  2. All image component
  3. Labels used.

All must be in same order.

Then use when any component clicked,
Get the index by comparing clicked image component with global list. With this index use select list item list from Tag name , and text of the label

Hello Tasha

Why are you getting a value immediately after storing it?

Your app could benefit from keeping lists of data and components, and implementing a sliding window to slide the components over the list of data.

Here is an example using Buttons and colors ...

Could you please give me an example ?

See, I like this idea a lot, but I would really like it to display 4 buttons

Hello again Tasha

The main area where code can be reduced is with your Procedures. You only need three Procedures, one each to record preference for breakfast, lunch and dinner, and the record requires only one tag for each too. Like this:

1 Like

oh wow, this is way tidier, thank you so much !

1 Like

Hello Tasha

Continuing with your Images as Buttons, you could also do this:

However, you could have just three meal buttons with a picker along side each, which would ensure your GUI fits the phone screen without the User needing to Scroll and reduce your code blocks too.

So, three button method (excuse the rough GUI layout):

Data_Storage2.aia (5.5 KB)


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