Re: gtk-demo ?



Geiregat Jonas wrote:

I tryed but my code doesn't work
I try to create a notebook with a textfield in it #include <gtk/gtk.h>
2 3 int main(int argc,char *argv[])
     4 {
     5         gtk_init(&argc,&argv);
6 7 GtkWidget *window;
     8         GtkWidget *text;
     9         GtkWidget *notebook;
10 11 window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    12         text = gtk_text_new(NULL,NULL);
    13         notebook = gtk_notebook_new();
    14         gtk_container_add(GTK_CONTAINER(window),notebook);
15 16 17 gtk_widget_show(notebook);
    18         gtk_widget_show(window);
19 20 gtk_main(); 21 22 return(0);
    23 }
function to add tab is gtk_append_page(GtkNotebook *,GtkWidget *,GtkLabel *)
in your case:

gtk_append_page(GTK_NOTEBOOK(notebook),text,NULL);
gtk_widget_show(text);

replacing NULL by a label allow to have a title in the tab
see http://developer.gnome.org/doc/API/2.0/gtk/GtkNotebook.html for the complete description

PS : you should read again the previous mail, i already talked about append_page ;)
PS2 : the GtkText widget is deprecated, (it is the API which said that), so you should use GtkTextView and 
GtkTextBuffer









[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]