Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
The following issue disturbs me: I'm using overrideredirect to remove decorations and as a result the widget is always on top. This is usually fine, but sometimes I want to have a popup on top of the MW, but overrideredirect seems to always win. Is there anyway to make a window on top of an overrideredirect window? I've extended a famous example to emphasize the issue
#!/usr/bin/perl -w use strict; use Tk; my $mw = tkinit; my $notification = $mw->Toplevel(); $notification->geometry('+400+400'); $notification->overrideredirect(1); # Remove window decorations $notification->withdraw; # Hide display window $notification->Label( -text => 'Your message displayed here.', -foreground => 'white', -background => 'black', -height => 5 )->pack; $notification->Button( -text => 'Press Me', -command => sub {my $msg = $mw->messageBox(-icon => 'error', -message => "No tests selected", -title => 'Error', -type => 'Ok', -default => 'Ok'); } )->pack; $mw->Button( -text => 'Display Notification Window', -command => \&display_note )->pack; MainLoop; sub display_note { $notification->deiconify; $notification->raise; # this is where you setup a condition to withdraw it $notification->after( 5000, \&hide_note ); } sub hide_note { $notification->withdraw; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Prevent overidedirect from being always on top (1+1 != 2 )
by Anonymous Monk on Jan 27, 2015 at 09:22 UTC | |
by Anonymous Monk on Jan 28, 2015 at 06:15 UTC | |
by Anonymous Monk on Jan 28, 2015 at 07:56 UTC | |
|
Re: Prevent overidedirect from being always on top
by Anonymous Monk on Jan 27, 2015 at 21:22 UTC | |
by Anonymous Monk on Jan 28, 2015 at 01:58 UTC |