(no subject)
- From: "lijian" <lijiangreat1 163 com>
- To: "gtk-app-devel-list" <gtk-app-devel-list gnome org>
- Subject: (no subject)
- Date: Tue, 19 Apr 2005 15:59:32 +0800
Hello,I am new to learn gtk.
I have write a very simple program,the following is the source code:
---------------------------------------------------------------------
#include<stdio.h>
#include<gtk/gtk.h>
#define GTK_ENABLE_BROKEN
gint delete_event(GtkWidget * window ,gpointer data)
{
gtk_main_quit();
return FALSE;
}
int main(int argc ,char * argv[])
{
GtkWidget * window;
GtkWidget * box;
GtkWidget * text;
GtkWidget * table;
GtkWidget * hscroll;
GtkWidget * vscroll;
gtk_init(&argc,&argv);
window=gtk_window_new(GTK_WINDOW_TOPLEVEL);
g_signal_connect(G_OBJECT(window),"delete_event",G_CALLBACK(delete_event),NULL);
gtk_window_set_title(GTK_WINDOW(window),"Editor");
gtk_container_set_border_width(GTK_CONTAINER(window),400);
box=gtk_vbox_new(FALSE,0);
gtk_container_add(GTK_CONTAINER(window),box);
gtk_widget_show(box);
table=gtk_table_new(2,2,FALSE);
gtk_box_pack_start(GTK_BOX(box),table,TRUE,TRUE,0);
gtk_widget_show(table);
text=gtk_text_new(NULL,NULL);
gtk_table_attach(GTK_TABLE(table),text,0,1,0,1,GTK_SHRINK|GTK_FILL|GTK_EXPAND,GTK_EXPAND|GTK_FILL|GTK_SHRINK,0,0);
//gtk_widget_realize(text);
gtk_widget_show(text);
hscroll=gtk_hscrollbar_new(GTK_TEXT(text)->hadj);
gtk_table_attach(GTK_TABLE(table),hscroll,0,1,1,2,GTK_EXPAND|GTK_FILL|GTK_SHRINK,GTK_FILL,0,0);
gtk_widget_show(hscroll);
vscroll=gtk_vscrollbar_new(GTK_TEXT(text)->vadj);
gtk_table_attach(GTK_TABLE(table),vscroll,1,2,0,1,GTK_FILL,GTK_SHRINK|GTK_FILL|GTK_EXPAND,0,0);
gtk_widget_show(vscroll);
gtk_widget_show(window);
gtk_main();
return 0;
} //source code end
-----------------------------------------------------------------
and compile it on the Redhat 9 system with the command:
gcc Editor.c -o Editor `pkg-config --cflags gtk+-2.0` `pkg-config --libs gtk+-2.0`
but I was give the message as following:
Editor.c: In function `main':
Editor.c:32: warning: assignment makes pointer from integer without a cast
Editor.c:37: invalid type argument of `->'
Editor.c:41: invalid type argument of `->'
Editor.c:48:2: warning: no newline at end of file
-----------------------------------------------------//end
I don't know how to modify the source file,Can you help me ?Thanks very much.
Best wishes to you
your's ever:lijian
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]