GTK4 DropDown

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.

1 Like
  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 instead of Gtk4.jl. It is way easier to use for those who have not already climbed the GTK learning curve.