Gtk4 / listview questions

We have discussed that in some detail lately, and that is why I posted the Nim example here. You should find all this when you read the discussions of the last two or three weeks, or the last issue of the GTK4 tutorial of GtkListView with editable text examples for our books · Issue #33 · ToshioCP/Gtk4-tutorial · GitHub. Of course we do not know for sure if our sulotion is the best one. Short recap: The problem is, that GtkColumnView and GtkListView “recycle” widgets, so widgets are reused to display different data. One solution is, to assign in the bind callback the ordinal number of the data row to the widget. I did it with setData(), which assigns a pointer to a widget – pointer is basically a integer number. I could have subclassed the widgets instead, so give them an additional integer field, and store the row index there. But as it was only one field, I just used setData. Note that SetQData() is an optimized form of SetData, you can use SetData() and avoid the use of a “Quark”. In the case that your Python bindings do not provide SetData(), just do subclassing, that should be working in Python. A very different approach would be property binding, which I have not tested. For GtkStringObject we could bind the string property to the text field of a GtkEntry. But when GtkStringObject can not be used as item of the Model, maybe because we want to use other data types, then we would have to create new GObjects with our own property sets. That may work in Python, but is currently not supported in Nim. I may write some more about all this in the Nim GTK4 book later, maybe in late 2023. Maybe until then I will have learned some more about GtkColumnView, GtkListView and the other one, I think it was called GtkDropDown. You may also see my recent post and the nice comment of someone here: GtkColumnView is really not easy - #4 by ebassi