There are usecases where items should not be unselectable by the user.
For example in the tab_bar. With this commit, a tab bar user cannot
unselect a item by hand anymore.
Depends on D10305
There are usecases where items should not be unselectable by the user.
For example in the tab_bar. With this commit, a tab bar user cannot
unselect a item by hand anymore.
Depends on D10305
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
I had not noticed that tab_bars could be left with no page selected. But I thought we would be fixing this at the Single_Selectable level, by having a mechanism to force one element to be always selected. Maybe a new Efl.Ui.Select_Mode?
This is not solvable alone at the single_selection layer, as we would need something in the theme to ignore the clickable event of this beeing unpressed. We cannot just quickly change the selection state of the item again, as this would at least render one frame wrong.
We can add something ontop of single_selection that uses this property...
src/lib/elementary/efl_ui_tab_bar.c | ||
---|---|---|
133 | So by default tabs can be deselected by the user? |
So now, when you add items to a tab bar, you have to manually set allow_manual_deselection to false for every tab? Can't this be automated?
Builds, passes tests and fixes the issue as advertised. Code looks good to me.
src/lib/elementary/efl_ui_single_selectable.eo | ||
---|---|---|
34 | Controls whether items can be deselected by the user by clicking over the currently selected item. Keep in mind that this leads to containers with no item selected, which is not always desirable (for example, for tabs). | |
36 | $true if clicking on a selected item results in the item being deselected. |
so is this some alternative way after removing select_always?
as I see the usage looks quite similar..
I made the same mistake, but, no, they are different things :)
select_always allows you to select again and again the same object (even if it is already selected), so the application would receive the selected events multiple times.
This patch is about not allowing empty selections. Related, but not the same thing.
BTW, we already had this confusion in T8057#140379, in point number 5.
Alright, well it's been a while and we haven't come up with better ideas, so I don't want to block it anymore. I'm okay with this if nobody else has objections.