Re: Can anybody providing code about putting some controls to notebook?
- From: "Tadej Borovšak" <tadeboro gmail com>
- To: "xu jiang" <xujianghn gmail com>
- Cc: gtk-list gnome org
- Subject: Re: Can anybody providing code about putting some controls to notebook?
- Date: Fri, 12 Dec 2008 10:49:39 +0100
Hi.
Below is some sample code. You can pack any two widgets inside
GtkNotebook as label and content, but remember to explicitly show
label widget, since calling gtk_widget_show_all on toplevel window
will not suffice.
-----------
#include <gtk/gtk.h>
int
main( int argc,
char **argv )
{
GtkWidget *window;
GtkWidget *notebook;
GtkWidget *vbox;
GtkWidget *treeview;
GtkWidget *button;
GtkWidget *label;
gtk_init( &argc, &argv );
window = gtk_window_new( GTK_WINDOW_TOPLEVEL );
g_signal_connect( G_OBJECT( window ), "destroy",
G_CALLBACK( gtk_main_quit ), NULL );
vbox = gtk_vbox_new( FALSE, 5 );
label = gtk_label_new( "Page 1" );
gtk_widget_show( label );
notebook = gtk_notebook_new();
gtk_container_add( GTK_CONTAINER( window ), notebook );
gtk_notebook_append_page( GTK_NOTEBOOK( notebook ), vbox, label );
treeview = gtk_tree_view_new();
gtk_box_pack_start( GTK_BOX( vbox ), treeview, TRUE, TRUE, 0 );
button = gtk_button_new_with_label( "Testing button" );
gtk_box_pack_start( GTK_BOX( vbox ), button, FALSE, TRUE, 0 );
label = gtk_label_new( "Some text to populate this label" );
gtk_box_pack_start( GTK_BOX( vbox ), label, FALSE, TRUE, 0 );
gtk_widget_show_all( window );
gtk_main();
return( 0 );
}
---------------
2008/12/12 xu jiang <xujianghn gmail com>:
> Hi,
>
> Can you please give an example about how to adding a treeview control, a
> text and a button to a notebook?
>
> Thanks,
> Jane
>
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
>
--
Tadej Borovšak
00386 (0)40 613 131
tadeboro gmail com
tadej borovsak gmail com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]