welleozean has asked for the wisdom of the Perl Monks concerning the following question:

Dear Monks

I guess the answer to my question will be "No", but I just want to be sure.

I have a GUI written in TK which I cannot port to another GUI language, too much complicated. In my software I miss a row Web browser to quick open Webpages INSIDE my application. With Win32::GUI there is a quite simple way to integrate a Web Browser in the own GUI. My question: Is it possible o combine the two toolkits? The idea would be to have a TK pane (or similar) and open a WebBrowser Active X (Win32::GUI::AxWindow) in it?

In my script below I have the two components, what I miss (and I guess is not possible at all) is how to show the browser in a TK window. Unpossible, isn't?

#!/usr/bin/perl use warnings; use strict; use Tk; use Win32::GUI qw(); use Win32::GUI::AxWindow; my $mw = MainWindow->new; Browser(); MainLoop; sub Browser{ # Main Window my $Window = Win32::GUI::Window->new( -name => 'Window', -text => 'Win32::GUI::AxWindow Web Browser', -pos => [100, 100], -size => [640, 480], ); # Add a WebBrowser AxtiveX my $Browser = Win32::GUI::AxWindow->new( -parent => $Window, -name => 'Browser', -control => 'Shell.Explorer', -pos => [0, 0], -size => [640, 480], ); # Register some event $Browser->RegisterEvent( StatusTextChange => sub { my $self = shift; my $eventid = shift; print 'Event : ', @_, "\n"; } ); # Call Method $Browser->CallMethod('Navigate', 'http://www.perlmonks.org/'); # Event loop $Window->Show(); Win32::GUI::Dialog(); # Main window event handler sub Window_Resize { my($width, $height) = ($Window->GetClientRect)[2..3]; $Browser->Move (0, 0); $Browser->Resize($width, $height); return 1; } }

Replies are listed 'Best First'.
Re: Combining Win32::GUI and TK
by Anonymous Monk on Jan 31, 2016 at 06:19 UTC