Re: passing #define'd value to callback
- From: Peter Wurmsdobler <peter wurmsdobler ctm-france com>
- To: Darin Adler <darin eazel com>
- Cc: gtk-app-devel-list gnome org
- Subject: Re: passing #define'd value to callback
- Date: Thu, 12 Oct 2000 08:31:02 +0200
Darin,
Have the integer itself masquerade as a pointer, using the glib macros, like
this (I tried to imitate your formatting):
void mm_spin_radiobutton_clicked( GtkButton *button, gpointer data ) {
if ( GTK_TOGGLE_BUTTON(button)->active )
do_something(GPOINTER_TO_INT(data));
}
gtk_signal_connect(
GTK_OBJECT( mm_on_radiobutton ), "clicked",
GTK_SIGNAL_FUNC( mm_state_radiobutton_clicked ),
GINT_TO_POINTER(ON) );
This was my first attempt before posting the question,
but the result was a segmentation fault, maybe because
GINT_TO_POINTER() is nothing but (gpointer) which is
again (void *). Using this for 0 results in (void *)0
which is NULL. However I would like 0 and 1 because
I can directly use the values rather than strings.
peterw
--
Dr. Peter Wurmsdobler
CTM - Centre de Transfert des Microtechniques
39, av. de l'Observatoire, BP-1445, 25007 Besancon CEDEX 3
TELEPHONE: +33 3 81 47 70 20 TELECOPIE: +33 3 81 47 70 21
E-mail: peter wurmsdobler ctm-france com
Ceterum censeo MIRCOSOFTem esse delendam.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]