Gtk.jl icon indicating copy to clipboard operation
Gtk.jl copied to clipboard

CellRendererCombo model issue

Open KelvynCore opened this issue 5 years ago • 2 comments

Hi,

According to GTK documentation, CellRendererCombo has the property "model". But, the next code throws an error.

ls = ListStore(String)
cellCombo = CellRendererCombo()
set_gtk_property!(cellCombo, :model, ls)

(julia.exe:13864): GLib-GObject-WARNING **: 00:32:06.984: unable to set property 'model' of type 'GtkTreeModel' from value of type 'GObject'

I also tried with set_gtk_property!(cellCombo, :model, TreeModel(ls)).

My windows is shown. The combobox is displayed in the treeview but is empty because i need to link the model with the list to be displayed.

I don´t know is this is a bug.

Thanks

KelvynCore avatar Jan 30 '21 06:01 KelvynCore

I cannot complete answer the question but in many situations you need to manually cast the ListStore to a TreeModel explicitly like this:

  store = ListStore(String,String)
  tv = TreeView(TreeModel(store))

But I do not know if this it the problem in your case. What I usually do is shown here https://juliagraphics.github.io/Gtk.jl/latest/manual/listtreeview/

So first create the model, then the view and finally push! the renderers to the view.

tknopp avatar Feb 01 '21 12:02 tknopp

Thanks for your reponse. The problem is just in the definition of a CellRendererCombo(). the property model doesn't allow to pass any type of model, array, tuple...

I thik isn't implemented yet.

KelvynCore avatar Feb 02 '21 02:02 KelvynCore