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

Hey experts!

The idea here is to be able of withdraw the window, work in some application (which now has focus), pop up the Tk window with NO focus on it, with focus still in application I'm working in! This may have been mentioned earlier, but I was hoping this could work somehow, thanks to StayOnTop! I mean, if the Tk window is shown, stayontop is enabled on the $frame, and I click on some other window (in windows), the Tk is still on top. Unfortunatly, it doesnt really seem to work getting it back from "withdrawn" without it getting focus! Ideas?
use Tk; use Tk::StayOnTop; use strict; use warnings; #use diagnostics; my $frame = new MainWindow; #my $frame = $mw->Toplevel(-title => "Hide/Show testing"); #$frame->stayOnTop(); $frame->withdraw; $frame->after(1000, sub {$frame->stayOnTop(); }); $frame->after(2000, sub {$frame->deiconify; }); $frame->after(10000, sub {$frame->withdraw; }); $frame->after(20000, sub {$frame->deiconify; }); $frame->after(25000, sub {$frame->withdraw; }); &centerWindow($frame, 150, 150); MainLoop; sub centerWindow { my($window, $width, $height) = @_; $width = $window->reqwidth unless $width; $height = $window->reqheight unless $height; my $x = int(($window->screenwidth / 2) - ($width / 2)); my $y = int(($window->screenheight / 2) - ($height / 2)); $window->geometry("=${width}x${height}+${x}+${y}"); }

Replies are listed 'Best First'.
Re: Tk window still ontop but no focus
by Anonymous Monk on Oct 21, 2005 at 14:18 UTC
    Tk cant do that
      Was afraid of that. How about with Win32::GUI? Or wx?