Re: Parameter passing advice...
- From: "Tara M" <learfox furry ao net>
- To: "LIST: GTKAppDevel" <gtk-app-devel-list gnome org>
- Subject: Re: Parameter passing advice...
- Date: 25 Sep 2001 13:59:57 PDT
On Tue, 25 Sep 2001 13:45:26 -0400 (EDT), Chris Elston said:
Sometimes, one parameter is not enough. What methods have you all used in
the past to get around having only one gpointer at your disposal when you
need much more? GLists? Arrays? some kind of hack around with regards
to the nature of void pointers?
Here's a generate rule that's helpful for beginners.
For any signal who's name is of the format "<whatever>_event"
(like "button_press_event") the inputs for the callback function
is:
gint (*func_cb)(GtkWidget *widget, GdkEvent *event, gpointer data)
For all other signal names, just look at the header files, say
you want to find the inputs for the "select_row" signal generated
by the GtkCList. Look at gtk/gtkclist.h and look for the class
(specifically, _GtkCListClass).
Look at the prototype:
void (*select_row) (GtkCList *clist,
gint row,
gint column,
GdkEvent *event);
So the "select_row" signal takes those inputs as you see PLUS
a gpointer data at the end. ALWAYS append a gpointer data to the
end, so your callback function should look like:
void (*func_cb)(GtkCList *clist, gint row, gint column, GdkEvent event,
gpointer data)
Hope that helps!
--
--
Sincerely, ,"-_ \|/
-Capt. Taura M. , O=__ --X--
.__ ,_JNMNNEO=_ /|\
OMNOUMmnne. {OMMNNNEEEEOO=_
UOOOBIOOOEOMMn. 'LONMMMMNNEEEOOO=.__..,,..
UUOOEUUOOOOOOOObe '"=OMMMMWNEEEOOOOO,"=OEEEOO=,._
OOUUUIEEIOONNOIUbe. "7OMMMMNNNNNWWEEEEOOOOOO" "'.
EEBNNMMMNWNWWEEIMMNe. __ 7EMMMNNNNNWWWEEEEEEEOO. " .
NNMMMMWWWMMMWEINMMMNn "=BBEEEEMMMMMMMMNNNWWWEEOOOOO=._ .
http://furry.ao.net/~learfox/
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]