Re: Gtk::VBox problem in 0.97



On Monday, September 8, 2003, at 06:40 AM, Anuradha Ratnaweera wrote:


The following code works well in 0.96, but not in 0.97.

    my $notebook = Gtk2::Notebook->new();

    $vbox = Gtk2::VBox->new();
    $notebook->append_page($vbox, "Title");

With 0.97, the error message is

    variable is not of type Gtk2::Widget at CCat/UI/Main.pm line 62.

The second argument to Gtk2::Notebook->append_page must be a widget.

http://developer.gnome.org/doc/API/2.0/gtk/GtkNotebook.html#gtk- notebook-append-page

something as simple as

   $notebook->append_page ($vbox, Gtk2::Label->new ('Title'));

will do the trick.

this should go into the FAQ.  unless...


the rationale behind Gtk taking a widget here is that you can have anything you want as the notebook's tab label; a common variant is an HBox with a label and a button that closes the tab.

we had some discussion a while back about automatically turning strings passed into this set of functions into labels, and keeping other variables as widgets. posted something about the complications arising from adding the necessary magic to do the auto-labelification of strings, but never got a response, so i never committed my code to implement it.

   http://mail.gnome.org/archives/gtk-perl-list/2003-July/msg00086.html





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