gi-gtk-declarative icon indicating copy to clipboard operation
gi-gtk-declarative copied to clipboard

ListBox content change leads to cursor position reset

Open pmiddend opened this issue 4 years ago • 1 comments

I have a ListBox with some children. Now I select a row in the ListBox, and press a button that changes the content of the selected row (say, by changing a Label to "installed"). This seems to completely reset the ListBox selection (so that no item is selected). I sort of get the problem here, but I'd love to somehow manage the selection myself, and ideally by using an index, so the selection is kept, even on change.

pmiddend avatar Apr 07 '20 09:04 pmiddend

As I understand it, you should be able to change the content of a selected row without loosing selection, so long as the the changes don't require re-creating the entire row widget. Changing the text on a Label should not require recreating the Label, so that should work, I think. Could you paste a code sample?

As for managing the selection yourself, right now I think you would have to make a custom widget for this (see https://github.com/owickstrom/gi-gtk-declarative/blob/master/examples/CustomWidget.hs).

Dretch avatar Apr 25 '20 12:04 Dretch