Re: C/GTK+ Is it possible? access child widgets having only the its container?



On Sat, 2005-11-19 at 21:03 -0200, Marcus Reis wrote:
Hello, suppose the scenario that we have a GtkTable declared as global
variable. Inside that table we have 9 event boxes with 1 GtkImage packed
in each one. Now we have a function that must change properties from
some images that are inside event boxes or even destroy the boxes. I
have tried to achieve this with the following (unsuccessful) code:


#######################################################################
static void some_function()
{
      int x;
      GList *list;
      GtkWidget *event_box;

      list = gtk_container_get_children(GTK_CONTAINER (global_table));
      g_print("We have %d elements",(g_list_length(list)));
      event_box = GTK_WIDGET (g_list_nth(list, 0));
      gtk_widget_destroy(GTK_WIDGET (event_box));
}
#######################################################################



Hi,
I think you should use g_list_nth_data instead of g_list_nth. The
g_list_nth return the list element, not its content.

Luca




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