[Gtk.jl] Stuck with GtkTreeView generated with Glade

,

Hi there,

I have started a Gtk.jl project with a base layout generated by Glade.
I struggle with assigning a GtkTreeModel to a Glade generated GtkTreeView

Even though I could generate the TreeView manually, I feel I am missing something. Can someone help? Below is a somewhat M(non)WE (I do not provide a glade file, but let me know if needed)

 # Associates widgets from GtkBuilder
    win = builder["window"]
    ...
    tree = builder["tree"]
    ls = GtkTreeStore(String)
    info = push!(ls, ("Information",))
    index = push!(ls, ("Index",))
    test = push!(ls, ("Test",), index)
    tm = GtkTreeModel(ls)

    # push!(tree, GtkTreeModel(ls)) # doesn't work
    # set_gtk_property!(tree, :child, tm) # doesn't work

It seems that the general way to do it for Gtk (even non-julian) is to not generate the TreeView widgets with Glade. We can thus add them manually, initialised correctly, to their container widget.

1 Like

How you tried creating the store in Glade? I have done some examples in the past where I created the store in Glade itself and assigned it to a widget in Glade. You could probably reference it from the code and replace content in it.

For TreeView I usually define the model in code and push the TreeView into a Box generated by Glade. We had a similar case recently: https://github.com/JuliaGraphics/Gtk.jl/issues/606