Le mercredi 14 décembre 2005 à 15:39 +0100, [EMAIL PROTECTED] a écrit :
> Hi,
> I can't compile using gtk_timeout_add (or g_timeout_add, the problem
> is the same...). I'm using C++...
> The error is:
> 
> In member function `virtual void dialogAcquisizione::on_okbutton2_clicked()':
> error: argument of type `gint (dialogAcquisizione::)(void*)' does not
> match `gboolean (*)(void*)'
> 
> The code is (all in the same class):
> 
> #include <gtk/gtk.h>
> 
> gint dialogAcquisizione::acquisisci(gpointer data)
> {
>       std::cout << "Sto acquisendo...\n";
>       return (TRUE);
> }
> 
> void dialogAcquisizione::on_okbutton2_clicked()
> {
>       std::cout << "Intercettato l'evento di ok\n"
>                       << "Inzializzo il timer\n";
>       guint timer_id;
>       timer_id = 
> gtk_timeout_add(5000,(GtkFunction)dialogAcquisizione::acquisisci,NULL);
>       //this.hide();
> }
> 
> Why???

You cannot use a C++ class method directly in gtk_timeout_add. One way
to do that is:

void cb_timeout (dialogAcquisizione *dialog)
{
        dialog->acquisici(NULL); // do you really need an argument?
}

...

        timer_id = gtk_timeout_add(5000,G_CALLBACK (cb_timeout), this);


_______________________________________________
gtk-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/gtk-list

Reply via email to