In short, This GTK function is not working for me.
I declared an external table of pointers to all the data
declared in main. This table is included in a file with callbacks.
The reason I use the Table is so I can pass more than two data
types to the handler.
The handler 'on_add_clicked' calls the append function--which should put my clist data in the list.
'on_add_clicked' is the handler that's connected to an
button that gets clicked when the user has filled in all the
entry boxex with their data,
the handler basically (should) grab the text from the entry boxes
and stick 'em in the clist object I created.
'user_data' is a pointer to a struct which encapsulates pointers to the objects created in main-- this is the
only way I how know to pass more than 2 objects to a gtk handler--other than evil global vars!
it can only accept 2 args: the object your hooking and some xtra
data.
Thanks for any help!
Code:
// the handler
gtk_signal_connect (GTK_OBJECT (button1), "clicked",
GTK_SIGNAL_FUNC (on_add_clicked),
&StuffyBoy);
on_add_clicked(GtkButton *button,gpointer user_data)
{
gint row;
Stuff * data;
gchar * ptex[3];
gchar **text;
data = (Stuff *)user_data;
// hooking
//entry box-- niether work
ptex[0] = gtk_entry_get_text(GTK_ENTRY(data->sentry1) );
ptex[1] = gtk_entry_get_text(GTK_ENTRY(data->sentry2) );
ptex[2] = gtk_entry_get_text(GTK_ENTRY(data->sentry3) );
text = ptex;
/*********The trouble call*******/
row = gtk_clist_append( (GtkCList *)data->sclist1,
text );
}
// below is table for accessing data in main
typedef struct {
GtkWidget *swindow1; // pointers to objects created in main
GtkWidget *sbox1;
GtkWidget *svbox1;
GtkWidget *smenubar1;
GtkWidget *svbox2;
GtkWidget *slabel1;
GtkWidget *sentry1;
GtkWidget *svbox3;
GtkWidget *slabel2;
GtkWidget *sentry2;
GtkWidget *svbox5;
GtkWidget *slabel3;
GtkWidget *sentry3;
GtkWidget *svbox6;
GtkWidget *shbox2;
GtkWidget *sbutton1;
GtkWidget *shbox3;
GtkWidget *sbutton2;
GtkWidget *sscrolledwindow1;
GtkWidget *sclist1;
GtkWidget *slabel4;
GtkWidget *slabel5;
GtkWidget *slabel6;
} Stuff ;
Stuff StuffyBoy;