Skip to content

Issues modifying the entries of a ComboBox #606

@Boxylmer

Description

@Boxylmer

I currently have a simple combobox connected to a GtkListStore with a default entry. I want to add a few entries (and later remove / update them) and finally, access the currently chosen value when a button is pressed. I've made a mockup in Glade, but am struggling to actually see the results even though I can access the added values with indexing.

using Gtk
gladefile = GtkBuilder(filename=joinpath(@__DIR__, "basicapp.glade"))
showall(win)
combo_charge_port = gladefile["combo_charge_port"]
list_charge_ports = gladefile["list_charge_ports"]
btn_refresh_ports = gladefile["btn_refresh_ports"]
function btn_refresh_ports_clicked(widget)
    push!(list_charge_ports, ("test", 2))
end
signal_connect(btn_refresh_ports_clicked, btn_refresh_ports, "clicked")
julia> list_charge_ports
GtkListStoreLeaf()
julia> list_charge_ports[2]
("test", 2)
julia> list_charge_ports[1:2]
ERROR: MethodError: no method matching getindex(::GtkListStoreLeaf, ::UnitRange{Int64})

The docs point me to the list and tree widgets but I'm having a very difficult time generalizing what's going on here to modifying an existing widget from glade. Using the standard accessor notation from the built gladefile, it seems I only have access to the GtkListStoreLeaf and not the GtkListStore

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions