Re: Transmit an array to a function



Jean-Christophe Berthon wrote:
> 
> I'm not sure about it but try this :
> gtk_signal_connect (GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(function),
> widget);
> according that widget is the name of your array (GtkWidget *widget[20])
> This should work, I think (thought I never tried it...)

No it doesn't work. During the compilation I get it:
warning: passing arg 4 of `gtk_signal_connect_object' from incompatible
pointer type
But, anyway the prog works even with this compilation error.
I can avoid this error by using "(gpointer)widget" instead of "widget"
In fact, it's not the point. The pb is that I can transmit widget[1]
without any pb but I can't transmit the whole array in the same call.
Idem if I want to transmit an array of char:

char *caract[20];
gtk_signal_connect
(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(function),(gpointer)carac);
<-- won't work
gtk_signal_connect
(GTK_OBJECT(button),"clicked",GTK_SIGNAL_FUNC(function),(gpointer)carac[1]);
<-- will work
(Of course, I change the receiving function to sync with the call)

So, I am really lost... It must exist a solution to transmit an array of
any type, no?

Anthony

-- 
http://www.freeciv.fr.st




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