A SOLUTION: I awoke during the night recalling a method I'd seen in the
Win32Util module about "always keep ontop". Its a bruteforce way of forcing your Tk Window to the front and *keeping it there* even if you maximise other windows. See the amended code below. (Note: setting the optional flag to 1 forces it ontop, setting it to 0 disables it.
The mind of a programmer never sleeps! :-)
## Insert these into main
use Win32::Sound;
use Win32Util;
## subroutine for dying
sub dying {
my ($error) = @_;
if (!$error) {
$error = "(none given)";
}
my $text;
$text .= "\n\nTARsync Error:\n\nFailed during:\n$message\n\nReason
+:\n$error";
if ($poperr) {
my $box = new MainWindow(-title => "TARsync failed!",
-bg => 'yellow',
-bd => 4,
-relief => 'ridge');
$box->overrideredirect(1);
my $label = $box->Label(
-textvariable=> \$text,
-bg=> 'yellow',
)->pack(-fill=>'both',
-padx => 40,
);
Win32::Sound::Play('SystemExclamation');
my $ok = $box->Button(-text => "OK",
-command => [ sub{$box->destroy;
exit;
} ]
)->pack(-padx => 20,
-pady => 20
);
$box->withdraw;
$box->Popup;
Win32Util::keep_on_top($box, 1);
MainLoop;
}
}
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.