[gtkada] Gtk.Tree_Model.Nth_Child with Gtk.List_Store.Gtk_List_Store.

Emmanuel Briot briot at adacore.com
Thu Mar 10 10:22:54 CET 2016


> I want to do the same with GTKAda:
>      function Remove (Store   : in Gtk.List_Store.Gtk_List_Store;
>      N : in Natural) is
>      Iter : Gtk.Tree_Model.Gtk_Tree_Iter := Gtk.Tree_Model.Nth_Child (Gtk.Tree_Model.Gtk_Tree_Model(Store), Gtk.Tree_Model.Null_Iter, Glib.Gint(N));
> ...
> 
> But GNAT complains:
> invalid conversion, not compatible with type "Gtk_List_Store" defined at gtk-list_store.ads:173


Would help if you could quote the code correctly, this is really hard to read.

I assume the issue is

      Store : Gtk_List_Store;
      Gtk_Tree_Model (Store)

and indeed these two types are not compatible (A Gtk_Tree_Model is a gtk+ interface, which is
not mapped to an Ada interface for various reasons).

If you look at gtk-list_store.ads, there is a section named "Interfaces", which provides a "+"
iterator to do the conversion.

So you can simply use

    +Store

to get a Gtk_Tree_Model

Emmanuel


More information about the gtkada mailing list