# GtkDropDown menu list update

**URL:** <https://discourse.julialang.org/t/gtkdropdown-menu-list-update/124355>\
**Category:** General Usage\
**Tags:** gtk4\
**Created:** [January 2, 2025, 10:38am UTC](https://discourse.julialang.org/t/gtkdropdown-menu-list-update/124355 "2025-01-02T10:38:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel.flono](https://avatars.discourse-cdn.com/v4/letter/d/41988e/32.png) [@daniel.flono](https://discourse.julialang.org/u/daniel.flono)\
**Post date:** [January 2, 2025, 10:38am UTC](https://discourse.julialang.org/t/gtkdropdown-menu-list-update/124355/1 "2025-01-02T10:38:29Z")

</div>

Hello Everyone,

I am creating my first GUI and got stuck. I defined the GUI in xml format and then used GTK4 and the GtkBuilder in the Julia code. The window appears with no problem. I just can’t figure out how to change the list of options in the dropdown menu after the widget is created. The example in the tutorial does not seem to work. Can’t link it properly due to julia site error:  
(`https://docs.juliahub.com/Gtk4/rFcBQ/0.7.3/manual/combobox/`)  
Here is the MWE of my program:

```julia
using Gtk4

b = GtkBuilder("ui.xml")
win = b["window"]
show(win)

reactor=("1")

reactor_ddm = b["reactor_dd"]
push!(Gtk4.model(reactor_ddm), reactor)

if !isinteractive()
    @async Gtk4.GLib.glib_main()
    Gtk4.GLib.waitforsignal(win,:close_request)
end

```

This is the error I get:

> ERROR: LoadError: MethodError: no method matching push!(::Nothing, ::String)  
> The function `push!` exists, but no method is defined for this combination of argument types.
> 
> Closest candidates are:  
> push!(::Any, ::Any, ::Any)  
> @ Base abstractarray.jl:3529  
> push!(::Any, ::Any, ::Any, ::Any…)  
> @ Base abstractarray.jl:3530  
> push!(::Base.Nowhere, ::Any)  
> @ Base array.jl:1821  
> …

Thanks in advance for the help!

---

<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:** [January 2, 2025, 12:03pm UTC](https://discourse.julialang.org/t/gtkdropdown-menu-list-update/124355/2 "2025-01-02T12:03:55Z")

</div>

It looks like the call to `Gtk4.model` is returning `nothing`, which happens when there is no list model set. In the Gtk4 docs the model is set by the constructor from the provided list of strings. Do you have a `model` property defined in your XML file for the dropdown widget? There’s an example here: [Gtk.DropDown](https://docs.gtk.org/gtk4/class.DropDown.html)

---

<div class="post-metadata">

**Author:** ![daniel.flono](https://avatars.discourse-cdn.com/v4/letter/d/41988e/32.png) [@daniel.flono](https://discourse.julialang.org/u/daniel.flono)\
**Post date:** [January 2, 2025, 12:28pm UTC](https://discourse.julialang.org/t/gtkdropdown-menu-list-update/124355/3 "2025-01-02T12:28:37Z")

</div>

Dear jwahlstrand,

Thank you! That was the source of the problem. 🙂  
I didn’t want to fill the dropdown menu in XML but rather from Julia because I had a matrix filled with data. That’s why I didn’t think about setting the `model` property in the XML file.

Thanks again!
