Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Adding ActiveX Control to Tk Window

by tcf22 (Priest)
on Jan 11, 2005 at 21:00 UTC ( #421422=perlquestion: print w/replies, xml ) Need Help??

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

I need to add an ActiveX control to a Tk window. Its a simple window. The object is created correctly, but i'm not quite sure how to get it to show up. This is what i got so far.
#!/usr/local/bin/perl use strict; use Win32::OLE; use Tk; my $main = MainWindow->new(); $main->minsize(400,400); $main->title("STK/X Demo for Perl/Tk"); $main->configure(-background => 'black'); # Add ActiveX Component Here my $stkx = Win32::OLE->new('...') || die"Can't create STKX\n"; my $vo = Win32::OLE->new('...') || die "Can't create VO\n"; $stkx->ExecuteCommand('...'); MainLoop();

- Tom

Replies are listed 'Best First'.
Re: Adding ActiveX Control to Tk Window
by Mr. Muskrat (Canon) on Jan 12, 2005 at 05:31 UTC
Re: Adding ActiveX Control to Tk Window
by Courage (Parson) on Jan 12, 2005 at 06:38 UTC
Re: Adding ActiveX Control to Tk Window
by Grygonos (Chaplain) on Jan 11, 2005 at 21:08 UTC

    To my knowledge you can only add Tk widgets onto a Tk window. Thus, you'll have to roll your own Tk widget for this based on the methods and attributes of the OLE object. Something like Win32::GUI might be more what you need than Tk

Re: Adding ActiveX Control to Tk Window
by didier (Vicar) on Jan 12, 2005 at 09:30 UTC
    Here an example from: AxWindow
    You can host the Win32::GUI window in a Toplevel Tk Win using the 'use' arg with the hexa id of the win32 window.
    use Win32::GUI; use Win32::GUI::AxWindow; # Main Window $Window = new Win32::GUI::Window ( -name => "Window", -title => "Win32::GUI::AxWindow test", -post => [100, 100], -size => [400, 400], ); # Add a WebBrowser AxtiveX $Control = new Win32::GUI::AxWindow ( -parent => $Window, -name => "Control", -control => "Shell.Explorer.2", # -control => "{8856F961-340A-11D0-A96B-00C04FD705A2}" +, -pos => [0, 0], -size => [400, 400], ); # Register some event $Control->RegisterEvent("StatusTextChange", sub { $self = shift; $eventid = shift; print "Event : ", @_, "\n"; } ); # Call Method $Control->CallMethod("Navigate", 'http://www.perl.com/'); # Event loop $Window->Show(); Win32::GUI::Dialog(); # Main window event handler sub Window_Terminate { return -1; } sub Window_Resize { if (defined $Window) { ($width, $height) = ($Window->GetClientRect)[2..3]; $Control->Move (0, 0); $Control->Resize ($width, $height); } }


    Hope this help.

      Given that you gave complete code sample on Win32::GUI side, can you please provide complete example on Tk side?

      IMHO this really worth trying, but trying with pseudo-code is not easy

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://421422]
Approved by Old_Gray_Bear
Front-paged by Courage
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2023-03-30 05:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (73 votes). Check out past polls.

    Notices?