Re:Re: Calling function w/ multiple parameters



Thanks again for answering!  Okay, lets be even more specific.
This below is my calling statement:

gtk_signal_connect(GTK_OBJECT(GTK_FILE_SELECTION(f_group->f_window)->ok_button),                  
                            "clicked", (GtkSignalFunc)open_proc, f_group);

, where:  "f_group" is a pointer to a struct which contains some pointers to
Widgets and characters,  and "open_proc" is a function which is going to use
some of the already defined structure elements, and it's going to produce an
output before returning control.

The header of the called function looks like:

void open_proc (GtkWidget *widget, ff_struct *g_group) {...}

, where:  "ff_struct" is a typedef previously defined at the header of the file,
and which was used to define "f_group".  (Both "f_group" and "g_group" are
pointers to "ff_struct").  Here I'm simply defining "widget", so I have a second
argument to receive my pointer.

I've been doing calls like this, but passing pointers to Widgets without any
problems.  Here maybe I'm doing something really dumb related to pointers,
but I don't see it.  Again any information will be more than appreciated.

Thanks, ajam.

Michael J. Hammel wrote: 

   In a previous message, ajam says:
   > >Continuing my previous message, I opted to use a pointer to a
   > >structure to pass all the parameters to my function through
   > >the use of the fourth argument of "gtk_signal_connect()",
   > >which is actually expecting a "gpointer".  Well, it doesn't
   > >work.  No surprise here.  Is there a Macro or other method
   > >in order to be able to send this pointer to the function?

   Does your callback routine expect this gpointer as its second or third
   argument?  Some signals will pass this back as the 2nd parameter to your
   callback, others pass it back as the 3rd.  In the latter case the 2nd arg
   is actually a pointer to an GtkEvent  structure so you can tell what event
   actually caused the callback to be called.



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