On Thu, 25 Oct 2018 22:22:43 +0200, Mike Wey wrote:

On 25-10-18 20:17, aedt wrote:

Hello
When I run this program, instead of showing me a list of 3 rows, the treeview is showing me only 1 row. I'm guessing the iter is not pointing to the new row in buildModel()? If not, what's causing this?

You will need to call append to add a new row, append will also update
the iter.

ListStore buildModel() {
     import gtk.ListStore : ListStore;
     import gtkc.gobjecttypes : GType;

     auto ls = new ListStore([GType.STRING, GType.STRING]);

     import gtk.TreeIter : TreeIter;

     auto ti = ls.createIter();

     ls.setValue(ti, Columns.TEXT, "Arch");
     ls.setValue(ti, Columns.EDITABLE_TEXT, "https://www.archlinux.org/");
     ls.append(ti);
     ls.setValue(ti, Columns.TEXT, "Debian");
     ls.setValue(ti, Columns.EDITABLE_TEXT, "https://www.debian.org/");
     ls.append(ti);
     ls.setValue(ti, Columns.TEXT, "Fedora");
     ls.setValue(ti, Columns.EDITABLE_TEXT, "https://getfedora.org/");

     return ls;
}

Interesting. Thanks. Up until now, I have been calling a separate function that creates a TreeIter and adds value to a row. I didn't realize that the TreeIter needs to be appended (or created from the ListStore) to be pointing at the new row.

Thanks again.