Re: can't ercieve data passed to g_signal_connect
- From: rachit goel <panthers0072001 yahoo co uk>
- To: gtk-app-devel-list gnome org
- Subject: Re: can't ercieve data passed to g_signal_connect
- Date: Fri, 21 Apr 2006 12:45:35 +0100 (BST)
interface.h
.
.
.
GtkEventBox **eventt;
.
.
.
.
interface.c
GtkWidget* create_window1 (void)
{
.
.
.
.
.
eventt = g_new0 (GtkWidget * , tab_count);
.
.
.
for (iter = 1 ; iter <= tab_count ; iter++)
{
.
.
.
.
eventt[iter]=GTK_EVENT_BOX(gtk_event_box_new()); // create the event box
.
.
.
.
.
data1 = g_strdup_printf(" %d ",iter) ;
g_print("\n at signal connect string --> %s ",data1);
g_signal_connect ((gpointer)eventt[iter],"leave_notify_event", G_CALLBACK (mouse_leave1),data1);
g_signal_connect ((gpointer)eventt[iter],"button_press_event", G_CALLBACK (tab_click1), data1);
g_signal_connect ((gpointer)eventt[iter],"enter_notify_event", G_CALLBACK (tab_mouse_enter1) ,
data1);
...
}
}
void tab_click1(GtkWidget *widget,gchar* data1)
{
gchar *data_1 = (gchar*)data1;
unsigned long int val = strtol(data1,NULL,10) ;
g_print("%s data1\n",data1);
g_print("%d val1\n",val);
tab_modifier(1) ;
}
actually what i am doing is this:
i have declared an array of GtkWidget for Eventboxes since i get the number at run time from a database in
tab_count (using sqlite3 as database)
now i want to connect their signals to the same function as i don't know the number at the design time so
can't give that many functions and respective statements
the data passe through the signal handler will diferentiate the id of the event box that generated the event.
also same function can handle the multiple connect from various controls as it works well in case of first
connect here which is used to change the mouse over cursor
i never recieve the argument that i send.
---------------------------------
Switch an email account to Yahoo! Mail, you could win FIFA World Cup tickets.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]