tree widget not displaying
- From: Chris De Maeyer <chrisdm pandora be>
- To: gtk-app-devel-list gnome org
- Subject: tree widget not displaying
- Date: Fri, 09 Jan 2004 19:55:58 +0100
Having difficulty with a tree widget, seems to be processed but doesn`t
display anything in my gui:
vboxa0 = gtk_vbox_new (FALSE, 0);
framea1 = gtk_frame_new (" Airport ");
gtk_container_set_border_width (GTK_CONTAINER (framea1), 10);
gtk_container_add (GTK_CONTAINER (vboxa0),framea1);
labela = gtk_label_new (" Airport ");
store = gtk_tree_store_new (N_COLUMNS,
G_TYPE_STRING,
G_TYPE_STRING);
FillAirports(store);
tree = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store));
g_object_unref (G_OBJECT (store));
renderer = gtk_cell_renderer_text_new ();
g_object_set (G_OBJECT (renderer),
"foreground", "red",
NULL);
column = gtk_tree_view_column_new_with_attributes ("ID", renderer,
"text", ID_COLUMN,NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes ("Location",
renderer,
"text", NAME_COLUMN,NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (tree), column);
gtk_widget_show (tree);
gtk_widget_show (renderer);
gtk_widget_set_size_request(vboxa0,640,100);
gtk_widget_show (vboxa0);
gtk_widget_show (framea1);
and the tree composer function:
int fgk_ReadAirports(char *flyfile,GtkTreeStore *st)
{
FILE *tmp;
char str[256];
char word2[32];
int start,einde;
GString *tok;
if((tmp=fopen(flyfile,"r"))!=NULL) {
while(!feof(tmp)) {
fgets(str,sizeof(str)-1,tmp);
start = getDelimPos(str,' ',1);
einde = getDelimPos(str,' ',2);
memset(word2,0,32);
memcpy(word2,str+start,einde-start);
tok = g_string_new(word2);
/*combo_airports_list=g_list_append (combo_airports_list,
tok->str);*/
GtkTreeIter iter1; /* Parent iter */
gtk_tree_store_append (st, &iter1, NULL); /* Acquire a top-level
iterator */
gtk_tree_store_set (st, &iter1,
ID_COLUMN, tok->str,
NAME_COLUMN, "Donald E. Knuth",
-1);
}
fclose(tmp);
} else {
return(-1);
}
return(0);
}
Any ideas or remarks why this widget is not working?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]