Re: Style/Theory



"Sean Cody" <umcodysw@cc.UManitoba.CA> writes:

> But in my case I have a window where there is only 1 button which will have
> a call back..... how would I be able to get the data from each widget in the
> window the button is attached to when it is clicked?

OK, I thought you meant one button per entry.  In this case, if you
want the button to do something with each entry in turn, you could
attach a GList of the entries to the button, something like this:

    GtkWidget *button, *entry;
    GList *list;

    button = gtk_button_new_with_label ("foo");
    gtk_signal_connect (GTK_OBJECT (button), "clicked",
                        GTK_SIGNAL_FUNC (callback),
                        NULL);

    for (each entry)
      {
        entry = gtk_entry_new ();
        list = g_list_prepend (list, entry);
      }

    gtk_object_set_data (GTK_OBJECT (button), "entries", list);

And then in your button callback you could get the list from the
button using gtk_object_get_data(), and traverse that list.

    Andy
----   -----    --- --- - - --  ---- ---         -   - -  -   -       
Andrew Smith                                         amsmith@pmail.net
Future Illusions                              www.future-illusions.com
         -   -   -    -      -- ---- -- -    --------- - -------------



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