Hello!!! I hope to be asking in the right place, anyway I apologize in advance if I say something stupid.
So, I’m building an app with a list of checkboxes [listChb] aggregated into categories (8 checkboxes in 10 different categories, totaling 80 checkboxes, all of them will always be in the same order to help handling the names and states (true or false)). The state of each checkbox is saved in the list and then sent to Firebase under the tag day_month_year, so I can redeem the checkboxes that were marked or not in any other past day.
Here is where I’m stuck:
After changing the status of the checkboxes from FALSE to TRUE, I would like to know if there is a way to do a “when any checkbox.changed” and give a “replace” command in my checkbox list [listChb], by setting automatically the checkbox index to be replaed based on the checkbox that I changed.
I already created the first 8 buttons and in each one I inserted the function “replace list item” when the state is changed, manually informing the list index for the changed checkbox and sending the list to Firebase, but I don’t think this is a good programming practice and I would like to find out if there is a way to improve the handling of these checkboxes.
I think I’ve managed a way to make it but I don’t know if I get it straight.
In the beginning I was trying to change the state of checkboxes in a list that where filled with checkboxes, but the state of a checkboxes is a boolean, right?
After that I realized that I should have a list of booleans [lsBoolean] with the same lenght of the list of checkboxes [lsChb], so I could get the state (true or false) from the “lsBoolean” and set the values in the “lsChb” using the same index.
I’m sending the block so maybe you could analyze it and give your opinion, if I’m not asking too much.
My next step is to learn how to handle the lsBoolean so I don’t have to make 2 lists with 80 components each
just check the screenshots yourself… those which are not clickable are the tiny screenshots…
the first 2 from the first post and the screenshot from the last post…
strange… my own screenshot also is not clickable… what is going on?
When I’m using my smartphone I can open the images but in PC I have to right-click them and select “open image in another tab”.
Anyway, here we have a screenshot of the blocks with the implementation of “when any Checkbox.Changed” that is working. I would really appreciate if you could tell me if I am in the right way by using two lists, one for checkbox [lsChb] and other list for each state of the checkboxes [lsBoolean].
I did this, which results in a very tiny not readable image
this looks good…
let me suggest you to reuse these 8 checkbox components rather than creating 80 checkboxes… you could add a global variable category to identify the category and change the text of the checkboxes dynamically…