Re: difference between g_signal



On Fri, Mar 24, 2006 at 05:18:21PM +0100, Jerome Le Saux wrote:

GtkWidget* DirList, ....

// my button
 pMenuItem = gtk_menu_item_new_with_label(OPENDK);
 g_signal_connect_swapped(G_OBJECT(pMenuItem), "activate",
G_CALLBACK(OnOpenDkFile), DirList);

It isn't clear what value DirList has here, but let's suppose
it's OK.

 gtk_menu_shell_append(GTK_MENU_SHELL(pMenu), pMenuItem);

....

// my frame where I would to display my DirList widget
scrolled_window=gtk_scrolled_window_new(NULL, NULL);
  gtk_container_add(GTK_CONTAINER(pVbox), scrolled_window);
DirList = gtk_clist_new_with_titles (3, DirTitles);

Please do not use GtkCList, use GtkTreeView.  Any tutorial
that taught you to use GtkClist now in 2006 should go to
the stamping mill.

  g_signal_connect (G_OBJECT (DirList), "select_row", NULL, NULL);

The callback function definitely should not be NULL.

  gtk_container_add (GTK_CONTAINER (scrolled_window), DirList);

.....

// and my function OnOpenDkFile

int OnOpenDkFile( gpointer data)
{
char file[64][14];
...
// I open a dialog box to set the file to be selected
....
for (i=0;i<64,i++)
{
 strcpy(file[i],"totot");
}
gtk_clist_append(data,file);
}

and no problem during the compilation, but, either I obtain a seg fault when
I try to add file in the data gpointer, or  GTK return me that it can't
append into cllist . etc

How can I add element to the list.

Please convert the code to use GtkTreeView.

And how the list can be displayed into the scrolled window ?

GtkTreeView supports scrolling natively (don't know about
GtkCList), so gtk_container_add(scrolled_window, treeview);
should suffice.

Yeti


--
That's enough.



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