Re: #define as callback data
- From: Deepu T Roy <deepu_roy yahoo com>
- To: gtk-app-devel-list gnome org
- Subject: Re: #define as callback data
- Date: Thu, 28 Jun 2001 01:41:42 +0530
It would compile but would give a warning. Instead I suggest you use the macros
GINT_TO_POINTER( ) and GPOINTER_TO_INT( )
deepu
On Tue, 26 Jun 2001, Black wrote:
Actually (gpointer)OFF should work, it is what I am using at the moment
I have a line like this:
gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
GTK_SIGNAL_FUNC (focus_change),(gpointer)HEIGHT);
where HEIGHT is a #define <something>
Then, focus_change looks like:
void focus_change( GtkWidget *widget,gpointer *data ){
focus = (int)data;
}
It works fine for me.
-christopher
On Tue, 26 Jun 2001, Peter Wurmsdobler wrote:
Hello,
Maybe this quesion has been posed already, but I am still
looking for a better solution like this:
----begin common.h-------
#define OFF 0
----end common.h-------
----begin xmcm.c-------
#include "common.h"
static int off_cb = OFF;
gtk_signal_connect(
GTK_OBJECT( mm_off_radiobutton ), "clicked",
GTK_SIGNAL_FUNC( mm_state_radiobutton_clicked ), &off_cb );
----end xmcm.c---------
-----begin mcm.c-------
void mm_state_radiobutton_clicked( GtkButton *button,
gpointer data )
{
if ( GTK_TOGGLE_BUTTON(button)->active )
shm->mm_state = *((int *)(data));
}
----end mcm.c-------
What I would actually look for is to pass OFF directly to
gtk_signal_connect but (gpointer)(OFF) does not work
thanks for any hints,
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.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]