[Glade-users] [Glade-users][Re] ? on lookup widget(...)

No, the first parameter doesn't mean the pointer to the parent widget.
It could be any widget which is in the same hierarchy, of course, with the
second parameter.

Refer to the definition for lookup_widget ();  (comment lines included)

/* In "support.c" generated by Glade */
lookup_widget                          (GtkWidget       *widget,
                                        const gchar     *widget_name)
  GtkWidget *parent, *found_widget;

  for (;;)     // finding "Root (Parent)" by the first param.
      if (GTK_IS_MENU (widget))
        parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
        parent = widget->parent;
      if (parent == NULL)
      widget = parent;

  found_widget = (GtkWidget*) gtk_object_get_data (GTK_OBJECT (widget),
                                                   widget_name);  // 
finding the requested widget
       // with its name.
  if (!found_widget)
    g_warning ("Widget not found: %s", widget_name);
  return found_widget;
/* ... */

ps. Sorry for my poor English  :-)

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