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

Pascal p.p14 at orange.fr
Thu Mar 10 10:09:29 CET 2016


Hello,

Here is a sample GTK C code:
(from http://scentric.net/tutorial/sec-treemodel-remove-row.html)
   gboolean
   list_store_remove_nth_row (GtkListStore *store, gint n)
   {
     GtkTreeIter  iter;

     g_return_val_if_fail (GTK_IS_LIST_STORE(store), FALSE);

     /* NULL means the parent is the virtual root node, so the
      *  n-th top-level element is returned in iter, which is
      *  the n-th row in a list store (as a list store only has
      *  top-level elements, and no children) */
     if (gtk_tree_model_iter_nth_child(GTK_TREE_MODEL(store), &iter, NULL, n))
     {
       gtk_list_store_remove(store, &iter);
       return TRUE;
     }

     return FALSE;
   }

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

Any idea?

Thanks, Pascal.
http://blady.pagesperso-orange.fr




More information about the gtkada mailing list