Page MenuHomePhabricator

elm_list_select_mode_set -> ELM_OBJECT_SELECT_MODE_ALWAYS issue/question
Open, HighPublic

Description

hi,

if i understand the docs right,

elm_list_select_mode_set(list, ELM_OBJECT_SELECT_MODE_ALWAYS);

is not working correct.
If i unselect an item in a list, the callback is not be called.

In the docs (https://www.enlightenment.org/_legacy_embed/group__Elm__List.html) stands

... ELM_OBJECT_SELECT_MODE_ALWAYS : This means that, even if selected, every click will make the selected callbacks be called. ...

i had a look at the code elm_list.c
in _item_unselect(Elm_List_Item_Data *it) is nothing about

elm_list_select_mode_set(list, ELM_OBJECT_SELECT_MODE_ALWAYS);

adding these lines from _item_select(Elm_List_Item_Data *it) into _item_unselect(Elm_List_Item_Data *it) makes ELM_OBJECT_SELECT_MODE_ALWAYS working

if (sd->select_mode == ELM_OBJECT_SELECT_MODE_ALWAYS)
{
   if (it->func) it->func((void *)WIDGET_ITEM_DATA_GET(eo_it), WIDGET(it), eo_it);
      evas_object_smart_callback_call(obj, "selected", eo_it);
}

i don't know if my thoughts are right or I'm totally wrong, then sorry about this ticket ;)

Greetings Simon

jf_simon created this task.Oct 8 2019, 1:36 AM
bu5hm4n triaged this task as High priority.Oct 8 2019, 1:36 AM
bu5hm4n added a project: efl: widgets.

... ELM_OBJECT_SELECT_MODE_ALWAYS : This means that, even if selected, every click will make the selected callbacks be called. ...

it means even if item is selected states,
if you click again,
it stays selected -> selected state,
and callback is called.

so once item is being selected, it should never be unselected.
it is more like, always selected item exist.

if you unselect item by calling api,
selected should not be called as it is cancellation of selection.

I think the problem could be exist in multi-select case,
and the reason it broken in multi-select case is this was designed for single selection only.
if we support this mode in multi selection, items cannot be cancelled.