Ask a question from GTK + that has plagued me for a long time.
Source: Internet
Author: User
Ask me a long-time question from GTK +, a general-purpose Linux technology-Linux programming and kernel information. Here is the details. The program of GTK + written today is as follows:
1 # include
2
3 gint x = 50;
4 gint y = 50;
5
6 void move_button (GtkWidget * widget, GtkWidget * fixed)
7 {
8 x = (x + 30) % 300;
9 y = (y + 50) % 300;
10 gtk_fixed_move (GTK_FIXED (fixed), widget, x, y );
11}
12
13
14 int main (int argc, char * argv [])
15 {
16 GtkWidget * window;
17 GtkWidget * fixed;
18 GtkWidget * button;
19
20 gtk_init (& argc, & argv );
21
22 window = gtk_window_new (GTK_WINDOW_TOPLEVEL );
23 gtk_window_set_title (GTK_WINDOW (window), "fixed container ");
24
25 gtk_signal_connect (GTK_OBJECT (window), "destory ",
26 GTK_SIGNAL_FUNC (gtk_main_quit), NULL );
27
28 gtk_container_set_border_width (GTK_CONTAINER (window), 10 );
29
30 fixed = gtk_fixed_new ();
31 gtk_container_add (GTK_CONTAINER (window), fixed );
32 gtk_widget_show (fixed );
33 int I;
34
35
36
37 for (I = 1; I <= 3; I ++)
38 {
39 button = gtk_button_new_with_label ("press me ");
40 gtk_signal_connect ("GTK_OBJECT (button)", "clicked ",
41 GTK_SIGNAL_FUNC (move_button), fixed );
42
43 gtk_fixed_put (GTK_FIXED (fixed), button, I * 50, I * 50 );
44 gtk_widget_show (button );
45
46}
47
48 gtk_widget_show (window );
49
50 gtk_main ();
51 return 0;
52}
When compiling, always report gtk4.c: In function 'main ':
Gtk4.c: 41: warning: passing arg 1 of 'gtk _ signal_connect 'from incompatible pointer type
Then run the command to report an error.
Gtk-WARNING **: gtk_signal_connect (): cocould not find signal "destory" in the 'gtkwindow' class ancestry
Segment Error
Many of my programs, such as gtk_signal_connect (GTK_OBJECT (window), "destory ",
GTK_SIGNAL_FUNC (gtk_main_quit), NULL );
The running result of the statement is Gtk-WARNING **: gtk_signal_connect (): cocould not find signal "destory" in the 'gtkwindow' class ancestry
Segment Error
I hope you can help me with my first post.
My LINUX system is redhat linux enterprise 3 kernel is 2.4.21-32.el
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service