[Gtk-sharp-list] Inserting Pixbufs into a TreeView?
Charles-Louis
charlouis.mono@wanadoo.be
07 Mar 2003 12:39:34 +0100
Solved the problem... the initialization of my TreeStore was incorrect.
By adding
new TreeStore ((int)TypeFundamentals.TypeString,
(int)TypeFundamentals.TypeString,
(int)TypeFundamentals.TypeObject)
--> Object was required for pixbuf
It worked...
Le jeu 06/03/2003 à 15:50, Charles-Louis a écrit :
> Hi,
>
> I have created a method to insert data into a TreeView, but insofar I
> have been unsuccessful at inserting Pixbufs into it.
>
> I'm using the following method to insert data:
>
>
> private void addData(TreeStore aStore, TreeIter aIter, string aMessage){
> GLib.Value Id = new GLib.Value(i.ToString());
> GLib.Value Msg = new GLib.Value(aMessage);
> GLib.Value Img =
> new GLib.Value(new Pixbuf("pixmaps/Icon1.bmp"));
> aStore.Append(out aIter);
> aStore.SetValue(aIter,0,Id);
> aStore.SetValue(aIter,1,Msg);
> aStore.SetValue(aIter,2,Img);
> i++;
> }
>
> The column is declared as such:
>
> TreeViewColumn logImgCol = new TreeViewColumn();
> CellRenderer logImgRenderer = new CellRendererPixbuf();
>
> logImgCol.Title = ("Message");
> logImgCol.PackStart(logImgRenderer,true);
> logImgCol.AddAttribute(logImgRenderer,"pixbuf",2);
> treeLog.AppendColumn(logImgCol);
>
> When I compile the Assembly, I have no problem, but when I start
> inserting data, I get the following error:
>
> (<unknown>:1047): Gtk-CRITICAL **: file gtktreestore.c: line 620
> (gtk_tree_store_get_value): assertion `column < GTK_TREE_STORE
> (tree_model)->n_columns' failed
>
> (<unknown>:1047): GLib-GObject-CRITICAL **: file gobject.c: line 989
> (g_object_set_property): assertion `G_IS_VALUE (value)' failed
>
> (<unknown>:1047): GLib-GObject-CRITICAL **: file gvalue.c: line 147
> (g_value_unset): assertion `G_IS_VALUE (value)' failed
>
>
> And no image is shown in the TreeView... any ideas?
>
>
--
Charles-Louis <charlouis.mono@wanadoo.be>