Arbitrary Number of Horizontal Arrangements with Checkbox and Button [SOLVED]

Sorry for being obtuse, I’ll start with that. :dizzy_face:

I’ve looked at least a half-dozen discussions about Card View and Horizontal arrangements, but I just can’t figure out how to build what I want, which is the number of HA’s dynamically built based on an arbitrary number (later it will be based on the number of rows in my SQLite DB). The problem is that I want the HA’s to look like this with the Info button to the right of the CheckBox and its text, taking up the entire screen width like so:

Screenshot from 2020-09-08 18-27-37
Then the next HA is displayed below and takes the entire width of the display once again. Every time I build a Horizontal Arrangement dynamically, I get this:

Screenshot from 2020-09-08 18-39-36

Here are the blocks I’m using, and I don’t pretend to know exactly how this works. I’ve looked at guides, but I’m dad-gummed if I understand why a Dynamically built Horizontal Arrangement stacks items Vertically.

Screenshot from 2020-09-08 18-43-01

Screenshot from 2020-09-08 18-43-46

Screenshot from 2020-09-08 18-44-05

After trying to figure this out for several days now, I’d be very appreciative for any help. Just an example and I can go from there, but I can’t find one that does what I want that I can build on. A pointer to an example would be great! :pleading_face:

Thanks in advance, :sunglasses:
-Kevin

You are making the Checkbox and the Button inside CardViews.
Not inside Horizontal Arrangement.

First you Created a Horizontal Arrangement
Then a CardView inside it
Then Button and Checkbox inside the CardView

But it should be -
1st a CardView
Then a Horizontal Arrangement inside it
And at last Checkbox and Button inside the CardView

1 Like

Thanks very much for your reply. I tried to swap the order of the CardView and the HA, but I get a Runtime error:

Runtime Error
Attempt to invoke virtual method ‘java.lang.Class java.lang.Object.getClass()’ on a null object reference

Screenshot from 2020-09-09 08-59-52

I suspect feeding the cardView proc with a row is not correct. But where do I get an id, which is what I think it is expecting?

works for me

you can even add a space and make it take whole screen

Hmm, well could you send me your blocks just as a sanity check? Mine, not yours. :grin: Or maybe even a .aia?

Actually, now that I look at it a bit harder, you are not setting the HA and components Dynamically, so how would I set up an arbitrary number of HA/CheckBoxes/Buttons using your “works for me”?

Thanks for your reply.

Do you know what is the maximum amount of HA containers you may need?

No, not exactly. That’s why I want to create them on the fly. I have 3 sets of data that could be less than 10 per table or more than 40, but that could change as I add data to the DB. I only want to display those HA containers that would contain valid data.

I had a similar problem some time ago when I tried to create sprites and balls dinamically. They were created but didn’t accept some properties, like speed or heading.

I would encourage you to ask to the extension author or to post the question in his extension post:

1 Like

So, after much wailing and gnashing of teeth, I finally figured out how to do what I wanted to do. :joy:


I don’t yet understand the reason for multiplying row x 5. I’ve seen a lot of that in the various examples, but no explanation exists. Neither does an actual explanation of what a “CardView” is, I used a Vertical Arrangement and filled it with Horizontal Arrangements; each with a CheckBox and a Button.

Thanks to all who replied with help! :smiley:

2 Likes

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