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}"); }

In reply to Tk window still ontop but no focus by Ace128

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.