problem signal_connect to notebook



Hi, I have a strange problem with using the notebook widget.

I am simply trying to create a notebook with many pages and upon each
page I want to display text and a vertical scrollbar.  I am trying to
connect some code to the event "switch_page" on the notebook.  If I have
code to connect this, as well as the code to append pages, then the
program will not run.  It will, however, compile.  If I comment out
either the "gtk_signal_connect" line or the "gtk_notebook_append_page"
line it will run.

The following errors are issued upon running:

** WARNING **: invalid cast from `GtkLabel' to `GtkBox'

** ERROR **: sigsegv caught

The following is the problem section of code (with the problem lines
indicated):

        notebook = gtk_notebook_new ();
        gtk_signal_connect (GTK_OBJECT (notebook), "switch_page",
                            GTK_SIGNAL_FUNC (page_switch), NULL);
        /* This is one of the two problem lines of code. */

        gtk_notebook_set_tab_pos (GTK_NOTEBOOK (notebook), GTK_POS_TOP);
        gtk_box_pack_start (GTK_BOX (vbox), notebook, TRUE, TRUE, 0);
        gtk_container_border_width (GTK_CONTAINER (notebook), 5);
        gtk_widget_show (notebook);

        frame = gtk_frame_new ( pagetitle );
        gtk_container_border_width (GTK_CONTAINER (frame), 5);
        gtk_widget_show (frame);

        label = gtk_label_new ( pagetitle );
        gtk_notebook_append_page (GTK_NOTEBOOK (notebook), frame,
label);
        /* This is the other problem line of code. */


I simply do not understand what is happening in either of those lines to
cause this.  The code is copied from testgtk.c, which works. 
page_switch is a function that I have copied from the testgtk.c code.

Please help me.  If you do I'll give you a cyber hug.  :-)

-- 
Regards,
David Taylor

+============================================+
| University of Western Sydney - Nepean      |
| dtaylor@cit.nepean.uws.edu.au              |
| http://www.cit.nepean.uws.edu.au/~dtaylor/ |
+============================================+



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