Re: Associating data with list store
- From: Robert Pearce <rob bdt-home demon co uk>
- To: gtkmm-list gnome org
- Subject: Re: Associating data with list store
- Date: Sat, 2 Jun 2007 15:49:05 +0100
Hi Paul,
On Sat, 02 Jun 2007 08:44:50 -0400 you wrote:
> On Sat, 2007-06-02 at 12:26 +0100, Robert Pearce wrote:
> > Guys,
> >
> > I'm sure somebody here recently posted advice about tagging TreeModel entries with arbitrary data using a hidden column.
> >
> > I have an application where a ListStore is shown in a TreeView and each row needs to be associated with an instance of a data class. At the moment it's a horrid kludge because there is a std::vector of the data instances that needs to be kept in the same order as the ListStore. So I tried to take the advice I thought I'd read here.
> >
> > class DLF_ModelColumns : public Gtk::TreeModel::ColumnRecord
> > {
> > public:
> > Gtk::TreeModelColumn<Glib::ustring> varname;
> > Gtk::TreeModelColumn<Glib::ustring> value;
> > Gtk::TreeModelColumn<Glib::ustring> units;
> > Gtk::TreeModelColumn<Glib::ustring> description;
> > #ifndef SEPARATE_LIST_OF_ITEMS
> > // Gtk::TreeModelColumn< Glib::RefPtr<DLF_ScreenItem> > dataitem;
> > Gtk::TreeModelColumn<DLF_ScreenItem*> dataitem;
> > // Gtk::TreeModelColumn< Glib::Value<DLF_ScreenItem*> > dataitem;
> > #endif
> > Gtk::TreeModelColumn<int> objindex;
> >
> > DLF_ModelColumns() {
> > add(varname); add(value); add(units); add(description);
> > #ifndef SEPARATE_LIST_OF_ITEMS
> > add(dataitem);
> > #endif
> > add(objindex);
> > }
> > };
>
> have you tried the obvious:
>
>
> Gtk::TreeModelColumn<DLF_ScreenItem*> dataitem;
>
Yes, see above.... That's the version that mostly seems to work (there is a bug in a method that currently iterates over the list one entry per call) but throws pages and pages of GTK warnings and "critical"s when run. In particular, when creating and populating the ListStore, and iterating over it.
The first errors (during creation of the TreeView) are:
(process:27325): GLib-GObject-CRITICAL **: gtype.c:2242: initialization assertion failed, use IA__g_type_init() prior to this function
(ovscal:27325): Gtk-WARNING **: gtkliststore.c:302: Invalid type (null)
(ovscal:27325): GLib-GObject-WARNING **: gtype.c:3339: type id `0' is invalid
(ovscal:27325): GLib-GObject-WARNING **: can't peek value table for type `<invalid>' which is not currently referenced
(ovscal:27325): GLib-GObject-WARNING **: gvalue.c:96: cannot initialize GValue with type `(null)', this type has no GTypeValueTable implementation
(ovscal:27325): Gtk-CRITICAL **: gtk_list_store_set_value: assertion `G_IS_VALUE (value)' failed
(ovscal:27325): GLib-GObject-CRITICAL **: g_value_unset: assertion `G_IS_VALUE (value)' failed
(ovscal:27325): GLib-GObject-WARNING **: gtype.c:3339: type id `0' is invalid
(ovscal:27325): GLib-GObject-WARNING **: can't peek value table for type `<invalid>' which is not currently referenced
(ovscal:27325): GLib-GObject-WARNING **: gvalue.c:96: cannot initialize GValue with type `(null)', this type has no GTypeValueTable implementation
(ovscal:27325): Gtk-CRITICAL **: gtk_list_store_set_value: assertion `G_IS_VALUE (value)' failed
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]