Re: Searching widgets in a table
- From: Michael Natterer <mitch gimp org>
- To: Ignacio Nodal <inodal teleline es>
- Cc: GTK-List <gtk-list gnome org>
- Subject: Re: Searching widgets in a table
- Date: 01 Apr 2001 19:28:47 +0200
Ignacio Nodal <inodal teleline es> writes:
> I've got a table. The children field of a table is suppose to point into
> a GList,so at some point of my code I've got something like this:
>
> (...)
>
> gtk_table_attach_defaults (GTK_TABLE(table), separator, 0, 2, 2, 3);
> g_print("Searching separator...\n");
> pos = g_list_index(GTK_TABLE(table)->children, (gpointer) separator);
> if (pos!= -1) {
> g_print("Separator found, position: %d\n", pos);
> } else {
> g_print("Separator not found\n");
> }
>
> (...)
>
> g_list_index retuns always -1, so I must have misunderstood how it
> works..
>
> How can I find the position in this GList of a widget in the table?
>
> Do the elements of this GList point into GtkTableChild structures?
Yes, table->chidren is a list of GtkTableChild structures.
Do something like:
GList *list;
for (list = GTK_TABLE (table)->children; list; list = g_list_next (list))
{
GtkTableChild *child = (GtkTableChild *) list->data;
if (child->widget == (GtkWidget *) separator)
{
/* found it */
}
}
ciao,
--Mitch
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]