Listview grouping popup window examples

,

When running a closed-loop menu-driven program, that runs on the REPL and in which different types of data items are loaded, created, deleted, etc., I would like to keep track of them in a grouped listview popup window. Each time a change is made to the existing items, an update command should be sent to the listview window (or just redraw it).

Is there an example you know of that you could point me to for inspiration?

Thank you very much.


Figure Two random examples of grouped listviews

EDIT: I didn’t read the username! I’m sure you know all of that!


The most direct path to something similar to your screenshots is probably List and Tree Widgets · Gtk.jl

Other frameworks, are GitHub - barche/QML.jl: Build Qt5 QML interfaces for Julia programs. (which requires you to know a bit about QML itself), or you could try web engines like https://genieframework.com/ or GitHub - davidanthoff/Electron.jl: Julia wrapper for Electron or GitHub - JuliaGizmos/Blink.jl: Web-based GUIs for Julia.

The quickest path to get something similar, but not that REPL based, could be Pluto.jl. Not sure if that fits your application though, but very nice for prototypes and if the available views are not what you are looking for, it is super easy to write your own small HTML/JavaScript for custom visualizations.

2 Likes

Thanks for your advice.

I tried all the examples on the Gtk.jl page shown and all I got were empty windows :frowning: :

Gtk_v1.3.0_on_Win11_Julia_1.8.5

NB: using Julia 1.8.5 on Win11 and Gtk v1.3.0.

That is strange, for me the filtering exampled worked in a similar setup, e.g. List and Tree Widgets · Gtk.jl (juliagraphics.github.io)

(on Julia 1.9rc, Win11, Gtk v1.3.0)

1 Like

Ok, it seems I made a mistake.
showall() was already defined in my startup.jl and qualifying it with the Gtk. prefix solved the blank window problem.

1 Like

In case it might help others, I have copied below the Gtk.jl code used to produce the following scrollable Tree View:

Scrollable Gtk Tree View code
using Gtk, Printf

ts = GtkTreeStore(String, String, String, String)
tv = GtkTreeView(GtkTreeModel(ts))
sw = GtkScrolledWindow(tv)


# specific renderers for each of the columns:
rTxt = GtkCellRendererText()

c0 = GtkTreeViewColumn("#", rTxt, Dict([("text", 0)]))

c1 = GtkTreeViewColumn("Name", rTxt, Dict([("text", 1)]))
c2 = GtkTreeViewColumn("Weight", rTxt, Dict([("text", 2)]))
c3 = GtkTreeViewColumn("Units", rTxt, Dict([("text", 3)]))
push!(tv, c0, c1, c2, c3)

# Make columns resizable:
for c in [c0, c1, c2, c3]
    GAccessor.resizable(c, true)
end

# Make columns sortable:
for (i,c) in enumerate([c0,c1,c2,c3])
    GAccessor.sort_column_id(c, i-1)
end

# Add data to treeview:
iter1 = push!(ts, ("", "FRUITS", "", ""))
push!(ts, ("1", "Oranges", 1000, "kg"), iter1)
push!(ts, ("2", "Apples", 500, "lb"), iter1)
push!(ts, ("3", "Kiwis", 300, "kg"), iter1)

iter2 = push!(ts, ("","VEGETABLES","",""))
push!(ts, ("1", "Lettuce", 20, "lb"), iter2)
push!(ts, ("2", "Avocado", 150, "kg"), iter2)

iter3 = push!(ts, ("","CEREALS","",""))
for i in 1:100
  push!(ts, (@sprintf("%3i",i), rand(("Wheat","Rice","Oat")), rand(0:100), "ton"), iter3)
end

# Display
win = GtkWindow(sw, "Tree View")
Gtk.showall(win)

Q: How to set background colors to distinguish different rows?

1 Like