# GTK4 DropDown

**URL:** <https://discourse.julialang.org/t/gtk4-dropdown/107359>\
**Category:** New to Julia\
**Tags:** gui, gtk4\
**Created:** [December 9, 2023, 1:46pm UTC](https://discourse.julialang.org/t/gtk4-dropdown/107359 "2023-12-09T13:46:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![SergeantMike67](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/sergeantmike67/32/25103_2.png) [@SergeantMike67](https://discourse.julialang.org/u/SergeantMike67)\
**Post date:** [December 9, 2023, 1:46pm UTC](https://discourse.julialang.org/t/gtk4-dropdown/107359/1 "2023-12-09T13:46:24Z")

</div>

Keeping it simple about Drop Down widget

1. how do you capture the item into a variable for use in a SQL query?

2. how do you put in a list of new items into a previously created Drop Down?

These seem like very basic questiobs but I just cannot figure it out.

---

<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:** [December 9, 2023, 6:28pm UTC](https://discourse.julialang.org/t/gtk4-dropdown/107359/2 "2023-12-09T18:28:55Z")

</div>

1. I don’t know anything about SQL, but if you want to translate the human-readable string in the drop down to something else, you will have to use a dictionary. There is no “ID” string corresponding to each item, it’s just a list of strings.

2. You can fetch the model of the drop down using the unexported function `Gtk4.model`. The model behaves like an array of strings, so you can call `empty!` on it to remove all items, or `push!`, etc. to add new items. The drop down will be updated automatically.

The documentation for this widget was pretty bad and I just committed some improvements. But I actually think you should consider using [mousetrap](https://github.com/Clemapfel/mousetrap.jl) instead of Gtk4.jl. It is _way_ easier to use for those who have not already climbed the GTK learning curve.
