Re: problem with GtkListStore



chenjun1 egr msu edu wrote:

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));

^^^ Here you are setting model to non-existing tree view

        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();     

^^^ Here you are creating tree view. Move this line before gtk_tree_view_set_model call.

        GtkCellRenderer *renderer;
        GtkTreeViewColumn *column;
        renderer = gtk_cell_renderer_text_new();
        column = gtk_tree_view_column_new_with_attributes("Name", renderer,NULL);
^^^ Here you are creating completely broken column. Try this instead of line above: column = gtk_tree_view_column_new_with_attributes("Name", renderer, "text",0, NULL);

        gtk_tree_view_append_column(GTK_TREE_VIEW(tree), column);
        gtk_container_add (GTK_CONTAINER (scrolled_window2), tree);
        gtk_widget_show (tree);
   Olexiy




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