[Glade & Gtk-Perl] Adding widgets dynamically to windows

I want to add a CListModel to a scrolled window. Glade doesn't have a
CListModel in its widget palette, so I see a few options.

1) Use custom widget from palette
The debug output of glade2perl indicates that custom widgets are ignored.

2) Build GUI dynamically with libglade
I don't see a perl module giving access to libbglade, so assuming that
glade2perl generates a libglade application, I try to modify the files it
generates. Of the generated files, if I edit the <projectname>UI.pm, I can
make it do whatever I want since I can access the widgets right after they are
created in the code. But if I add some widgets through the Glade UI and then
generate the code again, my modifications are obviously lost. So I need to
make changes in the <projectname>.pm file. 

One way around this is to split off individual dialogs into files that Glade
will not touch again, but then you can't add any more widgets through the UI.

Back to the <projectname>.pm file. With all_forms, I can (per Gtk::cookbook)
get at any widget. Since I need to essentially do a
scrolledwindow->add(widget), I get the scrolled window by adding a signal:

      my ($class, $data, $object, $instance, $event) = @_;

      my $form = $__PACKAGE__::all_forms->{$instance};
      my $window = $form->{'scrolledwindow9'};
      my $clistmodel = &sub_that_makes_clistmodel;
This doesn't work:
   widget is not of type Gtk::Widget at line xx (the line with window->add).

If I use the class that comes in, $class, which prints out as a
there is still the same error. So how can I do this?


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