Hi, dear all, I plan to show a list inside a scrolled window. Everything is OK except that the content of every row in the list is not shown. If I click the row, it will turn color into blue. But I just can't see the content. What's wrong? Below is part of the code related to list. Attached is the whold .c files. thanks & br Jun GtkListStore *list_store; GtkWidget *tree; GtkTreeIter iter; list_store = gtk_list_store_new (1, G_TYPE_STRING); gtk_tree_view_set_model(GTK_TREE_VIEW(tree), GTK_TREE_MODEL(list_store)); gtk_list_store_append (list_store, &iter); gtk_list_store_set(list_store, &iter, 0, "Foo", -1); gtk_list_store_append (list_store, &iter); gtk_list_store_set(list_store, &iter, 0, "Foo", -1); gtk_list_store_append (list_store, &iter); gtk_list_store_set(list_store, &iter, 0, "Foo", -1); tree = gtk_tree_view_new(); GtkCellRenderer *renderer; GtkTreeViewColumn *column; renderer = gtk_cell_renderer_text_new(); column = gtk_tree_view_column_new_with_attributes("Name", renderer,NULL); gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column); gtk_container_add (GTK_CONTAINER (scrolled_window2), tree); gtk_widget_show (tree);
Attachment:
scrollview.c
Description: Binary data