/*function first*/
#include <gtk/gtk.h>
#include <stdio.h>
gint response(GtkWidget *widget,GdkEvent* event,gpointer data)
{
printf("button was pressed\n");
}
int main(int argc,char *argv[])
{
GtkWidget *window;
gtk_init(&argc,&argv);
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_set_usize(window,300,200);
gtk_signal_connect(GTK_OBJECT(window),"delete_event",GTK_SIGNAL_FUNC(gtk_mai
n_quit),NULL);
gtk_widget_show(window);
gtk_signal_connect_object(GTK_OBJECT(window),"button_press_event",GTK_SIGNAL
_FUNC(response),NULL);
gtk_main();
exit(0);
}
/*function second*/
#include <gtk/gtk.h>
#include <stdio.h>
gint response(GtkWidget *widget,GdkEvent* event,gpointer data)
{
printf("button was pressed\n");
}
int main(int argc,char *argv[])
{
GtkWidget *window;
GtkWidget *fixed;
gtk_init(&argc,&argv);
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_widget_set_usize(window,300,200);
gtk_signal_connect(GTK_OBJECT(window),"delete_event",GTK_SIGNAL_FUNC(gtk_mai
n_quit),NULL);
gtk_widget_show(window);
fixed=gtk_fixed_new();
gtk_container_add(GTK_CONTAINER(window),fixed);
gtk_widget_show(fixed);
gtk_signal_connect_object(GTK_OBJECT(window),"button_press_event",GTK_SIGNAL
_FUNC(response),NULL);
gtk_main();
exit(0);
}
The second function can receive button_press_event and the first can
not,why?
The widget that inherit GtkWidget could catch button_press_event,didn't so?
In second function I replaced GtkFixed by GtkBox . Then it can't catch
button_press_event.
Who can explain for me ?
Thank you!
_______________________________________________
gtk-list mailing list
[EMAIL PROTECTED]
http://mail.gnome.org/mailman/listinfo/gtk-list