Re: callback question



I have one general question. How to share a few parameters (e.g. form
ipset0 to ipset 4) to certain "my_call_back" callback using
gtk_signal_connect_object once.
In my "my_call_back" function I would like get text from each entry and
proceed it.

Something like this will do (replace dialog by something that suits you).
Moreover, using gtk_signal_connect in this case is probably simpler 
than gtk_signal_connect_object.
Carlos

gtk_object_set_data (GTK_OBJECT (dialog), "ipset0", ipset0);
gtk_signal_connect (GTK_OBJECT(ipset0), "activate",
GTK_SIGNAL_FUNC(my_call_back), dialog);

gtk_object_set_data (GTK_OBJECT (dialog), "ipset1", ipset1);
gtk_signal_connect (GTK_OBJECT(ipset1), "activate",
GTK_SIGNAL_FUNC(my_call_back), dialog);

gtk_object_set_data (GTK_OBJECT (dialog), "ipset2", ipset2);
gtk_signal_connect (GTK_OBJECT(ipset2), "activate",
GTK_SIGNAL_FUNC(my_call_back), dialog);

gtk_object_set_data (GTK_OBJECT (dialog), "ipset3", ipset3);
gtk_signal_connect (GTK_OBJECT(ipset3), "activate",
GTK_SIGNAL_FUNC(my_call_back), dialog);

in my_call_back:
ipset0 = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (dialog), "ipset0");
ipset1 = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (dialog), "ipset1");
ipset2 = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (dialog), "ipset2");
ipset3 = (GtkWidget *) gtk_object_get_data (GTK_OBJECT (dialog), "ipset3");

If you want to know which ipset? was called, just compare the ipset?
addresses with the calling widget address (the first argument of the callback
function.
with 




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