How to have a check box in a list

725 views
Skip to first unread message

M C

unread,
Apr 9, 2018, 4:17:00 PM4/9/18
to MIT App Inventor Forum
Does anyone know how to incorporate a checkbox into a list?

For example, if I have a list of player names, I would like the user to be able to select  say 2 out of the 4 players in order to start a game.

I'm able to create the player list, but I can't seem to incorporate the check boxes into a list view.

TimAI2

unread,
Apr 9, 2018, 4:40:24 PM4/9/18
to MIT App Inventor Forum
Save the status required of each checkbox out to a list: see example



M C

unread,
Apr 9, 2018, 4:57:11 PM4/9/18
to MIT App Inventor Forum
Thanks for your quick response, however I don’t want the check boxes to be visible as there could be a large number of list items.

When adding a new item to a list, I would like a check box to appear next to the list item.

SteveJG

unread,
Apr 9, 2018, 6:19:54 PM4/9/18
to mitappinv...@googlegroups.com
You want to do this




You cannot do this with App Inventor 2.   The ListView object does not have this capability.  It cannot simultaneously display the list item along a checkbox that is part of the List.  A ListView like this can be use if you program with Android Studio ... that does not help you.

The best you can do probably is create  either a list of pairs or two separate Lists that have their Indices synchronized.

LIst A                                     ListB
PlayerJohn                            true
PlayerTom                             false
PlayerAnna                            false
PlayerMC                               true   

and use them in conjunction with a screen that displays a column of  ListA Players and a column of ListB checkbox state    for the Player   that are reusible because there are perhaps only five or so items displayed at one time.

Someone else might have other ideas.

Regards,
Steve

Abraham Getzler

unread,
Apr 9, 2018, 8:29:40 PM4/9/18
to MIT App Inventor Forum

Ghica

unread,
Apr 10, 2018, 4:58:11 PM4/10/18
to MIT App Inventor Forum
Another way to do this is via a WebViewer. Not so easy to do, it means you create some html and communicate via WebViewString. The principle is explained here: https://puravidaapps.com/table.php
There is also Taifun's Multiple Choice Select: a Listpicker alternative for App Inventor, here http://puravidaapps.com/combobox.php (not free)
There seem also to be some extensions, look in Taifun's directory: https://puravidaapps.com/extensions.php
Cheers, Ghica

Reply all
Reply to author
Forward
0 new messages