El lun, 01 de 03 de 2004 a las 04:21, Quag Mire escribiÃ:
I use: gtk_widget_show_all(mainwindow); The TreeView widget itself is visible since I get the white background.
Ok, then it's almost sure you don't have a model in your treeview. Attach a GtkTreeModel matching your columns layout and you'll see the headers. Don't ask me why, but empty treeviews don't show the column headers ( at least it's my experience ). As example try this code, and once you see the header, comment out the store initiallization and change the treeview constructor to gtk_tree_view_new(). You will see it dissapearing. //----------------------------------------------------------------------- #include <gtk/gtk.h> GtkWidget* create_window (void); int main (int argc, char *argv[]) { GtkWidget *window; gtk_init (&argc, &argv); window = create_window (); gtk_widget_show (window); gtk_main (); return 0; } GtkWidget* create_window (void) { GtkWidget *window; GtkWidget *scrolledwindow; GtkWidget *treeview; GtkTreeViewColumn *column; GtkCellRenderer* renderer; GtkTreeStore* store; window = gtk_window_new (GTK_WINDOW_TOPLEVEL); gtk_window_set_title (GTK_WINDOW (window), "window"); scrolledwindow = gtk_scrolled_window_new (NULL, NULL); gtk_widget_show (scrolledwindow); gtk_container_add (GTK_CONTAINER (window), scrolledwindow); store = gtk_tree_store_new(1, G_TYPE_STRING); treeview = gtk_tree_view_new_with_model(GTK_TREE_MODEL(store)); gtk_widget_show (treeview); gtk_container_add (GTK_CONTAINER (scrolledwindow), treeview); column = gtk_tree_view_column_new(); renderer = gtk_cell_renderer_text_new(); gtk_tree_view_column_set_title (column, "Test header"); gtk_tree_view_column_pack_start (column,renderer, TRUE); gtk_tree_view_column_set_attributes (column, renderer, "text", 1, NULL); gtk_tree_view_column_set_resizable(column, TRUE); gtk_tree_view_append_column(GTK_TREE_VIEW (treeview), column); g_signal_connect ((gpointer) window, "delete_event", G_CALLBACK (gtk_main_quit), NULL); return window; } //--------------------------------------------------------------------------- compile with: gcc -c `pkg-config --cflags gtk+-2.0` code.c gcc `pkg-config --libs gtk+-2.0` code.o -o test You can also compile with a single command line if it's your preference. Hope this helps -- Iago Rubio http://www.iagorubio.com GPGkey pgp.rediris.es id 0x909BD4DD fingerprint = D18A B950 5F03 BB9A DD89 AA75 FEDF 1978 909B D4DD ********** iago.rubio(AT)hispalinux.es ********** --------------------------------------------------
Attachment:
signature.asc
Description: Esta parte del mensaje =?ISO-8859-1?Q?est=E1?= firmada digitalmente