about button_press_signal?
- From: "changan" <heface hotmail com>
- To: <gtk-list gnome org>
- Subject: about button_press_signal?
- Date: Thu, 17 Jan 2002 17:22:44 +0800
/*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!
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]