Add system-default checkboxes/toggles to my list?

I have a nice genlist, and I want to add checkboxes (/toggles) to all items.

I checked these pages:

You can provide an on/off switch, checkbox, or radio button along with the main text.

Perfect. How?

I’m aiming to be able to select items from the list, either with something like this:

Or with something like this:

I know I can use item_styles . Also know I can add my own images to swallow.end or similar.

But is there a way to use the same designs as the OS uses? To not break UI consistency?

In this system menu there is this “toggle” button, and it’s also animated (upon change):

image

How can I add this to my list?

Hello danergo,
To get a checkbox in a genlist item, you may set the style of the item to " 1text.1icon.1" as it’s described in the Using the Genlist Item Styles section in this link.

Moreover, you may create an item as below:

_itc = elm_genlist_item_class_new();
_itc->item_style = “1text.1icon.1”;
_itc->func.text_get = _item_label_get;
_itc->func.content_get = checkbox_content_get;
_itc->func.state_get = NULL;
_itc->func.del = NULL;

Thank you.

Hi, @ssaha, thx for the headsup!

In the meanwhile I have also realized this, and the only missing piece was to create the layout by adding the checkbox via elm_check_add.

Thanks again.