using lookup_widget



I have some "Segmentations Fault" problems using lookup_widget in a window

When I click in a Tlist's row, I want a string be added in Plist (just to be sure event works)
(and there come's seg fault)

Here is simplified window code :

// we assume all objects are contained in the window //
GtkWidget *mywindow(void)
{
	GtkWidget *EditWin;
	GtkWidget *TList;
	GtkWidget *PList;

	gchar *TListTitles[2]={"xxx","yyy"};
	gchar *PlistTitles[12]={"fff", etc...... };

	EditWin = gtk_window_new(GTK_WINDOW_TOPLEVEL);
	gtk_widget_set_name(EditWin,"EditWin");
	gtk_object_set_data (GTK_OBJECT(EditWin), "EditWin",EditWin);

	TList = gtk_clist_new_with_titles(2,TListTitles);
	gtk_signal_connect(GTK_OBJECT(TList),"select_row",(GtkSignalFunc)RowSelect,NULL);

	PList = gtk_clist_new_with_titles(12,PListTitles);
	gtk_widget_set_name(PList,"pList");
	gtk_object_set_data (GTK_OBJECT(EditWin),"pList",PList);

	return EditWin;
}

Here's the signal code of a selected row in TList:

gboolean RowSelect(GtkWidget *w, gint lig, gint col, GdkEvent *ev, gpointer d)
{
	gchar *x[12];
	
	GtkWidget *dList = lookup_widget(GTK_WIDGET(EditWin),"pList"); //here I want to get access to PList

	x[0]="selection ok";

	gtk_clist_append(GTK_CLIST(dList),x);

	return TRUE;
}

Did I rightly used the gtk_object_get/set_data ?



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