# Gtk4.jl get selected values from GtkMultiSelection

**URL:** <https://discourse.julialang.org/t/gtk4-jl-get-selected-values-from-gtkmultiselection/131596>\
**Category:** General Usage\
**Tags:** gtk4\
**Created:** [August 14, 2025, 4:03am UTC](https://discourse.julialang.org/t/gtk4-jl-get-selected-values-from-gtkmultiselection/131596 "2025-08-14T04:03:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jwright11](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jwright11/32/32065_2.png) [@jwright11](https://discourse.julialang.org/u/jwright11)\
**Post date:** [August 14, 2025, 4:03am UTC](https://discourse.julialang.org/t/gtk4-jl-get-selected-values-from-gtkmultiselection/131596/1 "2025-08-14T04:03:51Z")

</div>

Does anyone know how to get the user-selected values from a GtkMultiSelection in Gtk4.jl? I am trying the example code found [here](https://juliagtk.github.io/Gtk4.jl/dev/manual/listtreeview/) and shown below. I can’t seem to find any documentation on how to do it.

```julia-auto
using Gtk4

model = GtkStringList(string.(names(Gtk4)))
selmodel = GtkSelectionModel(GtkMultiSelection(GListModel(model)))

function setup_cb(f, list_item) # here `f` is the item factory
    set_child(list_item, GtkLabel(""))
end

function bind_cb(f, list_item)
    text = list_item[].string
    label = get_child(list_item)
    label.label = text
end

factory = GtkSignalListItemFactory(setup_cb, bind_cb)
list = GtkListView(selmodel, factory)

win = GtkWindow("Listview demo", 250, 800)
sw = GtkScrolledWindow()
win[] = sw
sw[] = list

```

---

<div class="post-metadata">

**Author:** ![jwright11](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jwright11/32/32065_2.png) [@jwright11](https://discourse.julialang.org/u/jwright11)\
**Post date:** [August 15, 2025, 7:02pm UTC](https://discourse.julialang.org/t/gtk4-jl-get-selected-values-from-gtkmultiselection/131596/2 "2025-08-15T19:02:59Z")

</div>

I was able to figure out that the `GtkSelectionModel` emits a “selection-changed” signal so I can detect when a change is made, but I don’t know how to extract the selected values. I’m trying to do something like this (which is not working):

```julia-auto
function ss(w, x, y)
    for child in selmodel.is_selected
        println("$child")
    end
end
signal_connect(ss, selmodel, "selection-changed")

```

---

<div class="post-metadata">

**Author:** ![jwahlstrand](https://avatars.discourse-cdn.com/v4/letter/j/bcef8e/32.png) [@jwahlstrand](https://discourse.julialang.org/u/jwahlstrand)\
**Post date:** [August 16, 2025, 2:04pm UTC](https://discourse.julialang.org/t/gtk4-jl-get-selected-values-from-gtkmultiselection/131596/3 "2025-08-16T14:04:41Z")

</div>

I just registered a new version of Gtk4.jl that supports getting the selection from `GtkMultiSelection`. This relies on `GtkBitset`, which previously wasn’t wrapped. There is a new example “listview\_multi.jl”. Eventually I will try to come up with a unified interface for getting the selection from `GtkSingleSelection` and `GtkMultiSelection`.

---

<div class="post-metadata">

**Author:** ![jwright11](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jwright11/32/32065_2.png) [@jwright11](https://discourse.julialang.org/u/jwright11)\
**Post date:** [August 17, 2025, 12:31am UTC](https://discourse.julialang.org/t/gtk4-jl-get-selected-values-from-gtkmultiselection/131596/4 "2025-08-17T00:31:15Z")

</div>

Thank you!
