Re: [anjuta-list] using gtktreeview and gtkliststore in Anjuta



Thanks so much! Everything works, now. And apparently the Gtk warning
was caused by trying to store a gdouble in a column that was set up
for a gint.

--Benton



On Mon, Jul 4, 2011 at 7:39 AM, Ian Liu Rodrigues <ian liu88 gmail com> wrote:
> You must create columns and then you need to pack GtkCellRenderer's in it.
> This is a simplified model:
>
> TreeView may contain several TreeViewColumns
> TreeViewColumns may contain several CellRenderer's
> CellRenderer's show data from TreeModel columns
>
> So, you must create columns and then create cell renderers under the column
> to show data.
>
> See http://scentric.net/tutorial/treeview-tutorial.html
>
> In glade, you can achieve this by right-clicking your column and selecting
> the apropriate cell renderer.
> After that, you must bind a column from the model with a cell renderer
> property.
>
> Ian L.
>
> On Mon, Jul 4, 2011 at 2:02 AM, Benton Greene <beezum88 gmail com> wrote:
>>
>> I tried that, and it still doesn't work. I created a test program. It
>> just has a TreeView, an "Add" button, a "Remove" button and a "Clear"
>> button, and a spin button to choose an integer value. When I click the
>> "Add" button, it should read the integer value in the spin button and
>> put it in the liststore. When I do that, though, I get the following
>> Gtk warning in the terminal:
>>
>> Gtk-WARNING **: /build/buildd/gtk+2.0-2.22.0/gtk/gtkliststore.c:797:
>> Invalid column number -1077906408 added to iter (remember to end your
>> list of columns with a -1)
>>
>> Also, when I add rows to the liststore using Glade, they still don't
>> show up, either.
>>
>> Here's a link to a tarball of the test project code:
>> http://dl.dropbox.com/u/7060786/list_store_test-0.1.tar.gz
>>
>> --Benton
>>
>>
>> On Sun, Jul 3, 2011 at 9:19 PM, Ian Liu Rodrigues <ian liu88 gmail com>
>> wrote:
>> > You must also create columns in your TreeView to show the ListStore
>> > columns.
>> > It is possible to create columns in the TreeView inside glade by
>> > right-clicking the
>> > TreeView and choosing "Edit...". After that, you can add columns at
>> > "Hierarchy" tab.
>> >
>> > Ian L.
>> >
>> > On Sun, Jul 3, 2011 at 8:25 PM, Benton Greene <beezum88 gmail com>
>> > wrote:
>> >>
>> >> I feel like I'm spamming the list a bit with all these questions, but
>> >> here's another one nonetheless.
>> >>
>> >> When you create a new GtkTreeView widget in glade, it asks you to also
>> >> create a liststore to connect to the treeview.  I did that, but no
>> >> matter what I did, editing the liststore never changed the treeview
>> >> widget in my program. I finally found a site that said it is
>> >> impossible to connect and edit a liststore in glade and you pretty
>> >> much have to do everything in code, and I found another site that gave
>> >> me some example code to work with and I got the program to work.
>> >> However, if it doesn't do anything, what is the purpose of having the
>> >> ability to create and edit liststores? Is this a bug? If it's not a
>> >> bug, what do I need to do to get it to work? It seems like a much
>> >> simpler solution to have default lists stored in the ui file and
>> >> initialized with GtkBuilder rather than running ten different list
>> >> initialization functions to create and connect treemodels, liststores,
>> >> and cell renderers for every treeview and combo box in a given
>> >> program.
>> >>
>> >> Thanks,
>> >> --Benton
>> >> _______________________________________________
>> >> anjuta-list mailing list
>> >> anjuta-list gnome org
>> >> http://mail.gnome.org/mailman/listinfo/anjuta-list
>> >
>> >
>> _______________________________________________
>> anjuta-list mailing list
>> anjuta-list gnome org
>> http://mail.gnome.org/mailman/listinfo/anjuta-list
>
>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]