[gtkada] gtk.list
Stephen Leake
stephen_leake at acm.org
Tue May 28 03:57:36 CEST 2002
I just figured out how to use a gtk list, and I have a suggestion.
In gtk-list.ads, we have:
procedure Append_Items
(List : access Gtk_List_Record;
Items : in Widget_List.Glist);
Since comments elsewhere in the spec talk about a list item being a
"plain label", I assumed that meant I could put a Gtk_Label on the
list:
declare
use Gtk.Widget.Widget_List;
Index_Widget_List : Glist;
List_Item : Gtk.Lable.Gtk_Label;
begin
Gtk.Label.Gtk_New (List_Item, "Name");
Append (Index_Widget_List, Gtk.Widget.Gtk_Widget (List_Item));
Gtk.Label.Gtk_New (List_Item, "ID");
Append (Index_Widget_List, Gtk.Widget.Gtk_Widget (List_Item));
Gtk.List.Append_Items (Author_List.Index_List, Index_Widget_List);
end;
Howevever, this is wrong. The items on the list have to be
Gtk_List_Items:
declare
use Gtk.Widget.Widget_List;
Index_Widget_List : Glist;
List_Item : Gtk.List_Item.Gtk_List_Item;
begin
Gtk.List_Item.Gtk_New (List_Item, "Name");
Append (Index_Widget_List, Gtk.Widget.Gtk_Widget (List_Item));
Gtk.List_Item.Gtk_New (List_Item, "ID");
Append (Index_Widget_List, Gtk.Widget.Gtk_Widget (List_Item));
Gtk.List.Append_Items (Author_List.Index_List, Index_Widget_List);
end;
So my suggestion is, can we change the Items parameter of
Gtk.List.Append_Items (and the other similar subprograms) to be a
List_Item_List, rather than a Widget_List? That would make this much
clearer. At the very least, there should be a comment at Append_Items
saying:
-- Items must be a list of Gtk.List_Items.Gtk_List_Item.
--
-- Stephe
More information about the gtkada
mailing list