in reply to Re: Prevent overidedirect from being always on top
in thread Prevent overidedirect from being always on top
That is clever, but is it needed?
as far as I can tell, it isn't needed, as the messagebox pops up on top of the notification no matter what happens
#!/usr/bin/perl -- use strict; use warnings; use Tk; Main( @ARGV ); exit( 0 ); sub Main { my $mw = tkinit( ); $mw->geometry('+300+400'); my $notification = $mw->Toplevel( ); $notification->geometry('+400+400'); $notification->overrideredirect(1); # Remove window decorations $notification->withdraw; # Hide display window $notification->Label( -text => 'keep clicking toggle ', -foreground => 'white', -background => 'black', -height => 5 )->pack; $notification->Button( -text => 'Press Me', #~ -command => [ \&important_message, $notification ], ## not +needed -command => \&important_message, )->pack; $mw->Button( -text => 'Display Notification Window', -command => [ 'deiconify', $notification ], )->pack->focus; $mw->Button( -text => 'toggle topmost notification ', -command => [ \&toggle_topmost , $notification ], )->pack; $mw->Button( -text => 'hide notification ', -command => [ 'withdraw', $notification ], )->pack; ## $mw->WidgetDump; ## debugging aid MainLoop; } sub important_message { #~ my( $n ) = @_; my( $n ) = $Tk::widget; #~ my $msg = $mw->messageBox( ## works to raise above $notificatio +n on win32, might not work on all platforms my $msg = $n->messageBox( -icon => 'error', -message => "No tests selected", -title => 'Error', -type => 'Ok', -default => 'Ok', ); } sub toggle_topmost { my( $n ) = @_; warn $n->attributes; $n->attributes(-topmost => ! $n->attributes(-topmost ) );; $n->parent->raise; $n->parent->focus; } __END__ __END__
|
|---|