Re: array of widgets...
- From: "Tara M" <learfox furry ao net>
- To: "Luiz Octavio de Almeida Soares" <loas procc fiocruz br>, <gtk-app-devel-list gnome org>
- Subject: Re: array of widgets...
- Date: 17 Aug 2001 13:56:13 PDT
On Fri, 17 Aug 2001 16:47:50 -0300, Luiz Octavio de Almeida Soares said:
what's the best way of passing an array of widgets to a callback? I've tried
many ways but cant seem to get this to work.
imagine sth like:
GtkWidget *entry[3];
GtkWidget *button;
button = gtk_button_new...
entry[0] = gtk_entry_new...
entry[1] ...
and i have a function named my_callback and i want it to receive the array
as a parameter when the user clicks the button. I tried many things with
gtk_signal_connect but none of them worked. Can anyone plz come up with a
simple solution for this?
Try using a structure instead, it would be able to contain multiple
arrays with totals. But in either case you choose you should
allocate the pointer array or structure and then passing it
to the callback.
mystruct *data = (mystruct *)g_malloc0(sizeof(mystruct));
/* Fill up the data structure here. */
gtk_signal_connect(
GTK_OBJECT(btn), "clicked",
myclickedcallback, data
);
/* Don't forget to destroy it when the widget is destroyed. */
gtk_signal_connect(
GTK_OBJECT(btn), "destroy",
mydestroycallback, data
);
--
--
Sincerely, ,"-_ \|/
-Capt. Taura M. , O=__ --X--
.__ ,_JNMNNEO=_ /|\
OMNOUMmnne. {OMMNNNEEEEOO=_
UOOOBIOOOEOMMn. 'LONMMMMNNEEEOOO=.__..,,..
UUOOEUUOOOOOOOObe '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
OOUUUIEEIOONNOIUbe. "7OMMMMNNNNNWWEEEEOOOOOO" "'.
EEBNNMMMNWNWWEEIMMNe. __ 7EMMMNNNNNWWWEEEEEEEOO. " .
NNMMMMWWWMMMWEINMMMNn "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._ .
http://furry.ao.net/~learfox/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]