On Fri, Feb 02, 2001 at 02:10:16PM +0100, Rosa Mannini wrote:
>
>
> On Fri, 2 Feb 2001, Francis Zagnoli wrote:
>
> > Hi all,
> >
> >
> > I would like to put on a window several buttons, and associate to
> > theses buttons a signal (clicked) to call the same function but with a
> > different parameter for each.
> >
> > Something like : on_button_clicked(1) for the button 1,
> > on_button_clicked(2) for the button 2, etc...
> >
> > But glade generate a function in callback.c with 2 parameters, a pointer
> > to the button or a gpointer user_data as follow
> >
> > on_Button_clicked (GtkButton *button, gpointer user_data).
>
> You have only to type the same function name for each button using Glade.
> Then open callbacks.c and callbacks.h and delete all the function you
> don't need (obviously you must save only one of these functions).
>
> So when one of these buttons emit "clicked" signal this function will be
> called passing as argument the button you have clicked.
>
> > How can I have something like : on_Button_clicked (gint ButtonNumber) or
> > even on_Button_clicked (GtkButton *button, gint ButtonNumber).
> >
> > Thank you in advance
> >
> > Philippe
>
>
> I hope to be useful.
>
> Rosa
>
If you wish to do it by passing integers, rather than as Rosa suggested,
you can take the reference to the integer, cast it to a gpointer and pass
this as the argument. Then in the callback, you can cast the gpointer back
to a pointer to the integer. Messy, but it should also work.
Edgar.
_______________________________________________
Glade-devel maillist - [EMAIL PROTECTED]
http://lists.helixcode.com/mailman/listinfo/glade-devel