Posted on 2005-04-18 15:23:56-07 by uwevoelker
Using Mozilla::DOM without gtk window
Hello Scott,

great work so far!

I was curious if I could use Mozilla::DOM without the Gtk2 window:
#!/usr/bin/perl -w use strict; use Cwd qw(getcwd); use Data::Dumper; use Gtk2::MozEmbed 0.04; my $moz = Gtk2::MozEmbed->new; $moz->signal_connect(net_stop => \&net_stop_cb); my $cwd = getcwd; $moz->load_url("file://$cwd/termine.html"); sleep(1); sub net_stop_cb { my $moz = shift; my $browser = $moz->get_nsIWebBrowser; my $window = $browser->GetContentDOMWindow; my $doc = $window->GetDocument; my $docelem = $doc->GetDocumentElement; print Dumper($docelem); return; }
But nothing happens. Do I really have to use?
my $window = create_window($class); # Display the application window. $window->show_all(); Gtk2->main();
Thank you,
good bye, Uwe
Direct Responses: 358 | Write a response
Posted on 2005-04-19 09:24:44-07 by slanning in response to 355
Re: Using Mozilla::DOM without gtk window

[Yrrr, I don't think writing replies in HTML is going to work out..]

You can in principle use it without a gtk window, since nothing in Mozilla::DOM depends on GtkMozEmbed, but I don't know of any other Perl module besides Gtk2::MozEmbed which embeds mozilla.

Gtk2::MozEmbed is a Gtk2::Widget, so you have to use something which can have a Gtk2::Widget added to it, which I believe implies a Gtk2::Container. Quickly grepping Gtk2,

./Gtk2/Bin.pm:@ISA=qw(Gtk2::Container); ./Gtk2/Box.pm:@ISA=qw(Gtk2::Container); ./Gtk2/CList.pm:@ISA = qw(Gtk2::Container); ./Gtk2/Fixed.pm:@ISA=qw(Gtk2::Container); ./Gtk2/Layout.pm:@ISA = qw(Gtk2::Container); ./Gtk2/List.pm:@ISA = qw(Gtk2::Container); ./Gtk2/MenuShell.pm:@ISA=qw(Gtk2::Container); ./Gtk2/Notebook.pm:our @ISA=qw(Gtk2::Container); ./Gtk2/Paned.pm:@ISA=qw(Gtk2::Container); ./Gtk2/Socket.pm:@ISA=qw(Gtk2::Container); ./Gtk2/Table.pm:@ISA=qw(Gtk2::Container); ./Gtk2/TextView.pm:@ISA=qw(Gtk2::Container); ./Gtk2/Toolbar.pm:@ISA=qw(Gtk2::Container); ./Gtk2/Tree.pm:@ISA=qw(Gtk2::Container); ./Gtk2/TreeView.pm:@ISA=qw(Gtk2::Container);

and whatever inherits from those (e.g. Gtk2::Window isa Gtk2::Bin).

Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.