Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Tk keep Toplevelwindow on top of its Mainwindow

by zentara (Archbishop)
on Jun 26, 2018 at 17:09 UTC ( [id://1217446]=note: print w/replies, xml ) Need Help??


in reply to Tk keep Toplevelwindow on top of its Mainwindow

You can always use the all-powerful overrideredirect(1). It's only drawback is your on-top window will be on top on every virtual desktop. The following script uses just about every trick. :-) It shouldn't leak memory with constant use.
#!/usr/bin/perl use Tk; my $mw= MainWindow->new(); ################################################################## my $dialogdel = $mw->Toplevel(-bg=>'steelblue'); #my $dialogdel = MainWindow->new(-bg=>'steelblue'); $dialogdel->overrideredirect(1); $dialogdel->geometry('200x100+600+100'); $dialogdel->configure(-cursor => 'top_left_arrow'); $dialogdel->Label(-text=>"Ready to delete $key_sel", -bg=>'pink', -fg=>'black', -width=>20)->pack(-side=>'top',-fill=>'x'); my $dlabel = $dialogdel->Label(-text=>"Confirm delete $key_sel?", -bg=>'yellow', )->pack(-side=>'top'); $dialogdel->Button( -text => 'Delete', -bg=>'yellow', -activebackground=>'orange', -command => sub{print chr(07) })->pack; $dialogdel->Button( -text => 'Cancel', -bg=>'red', -activebackground=>'plum', -command => sub{$dialogdel->grabRelease; $dialogdel->withdraw; } )->pack(-side=>'right',-anchor=>'e'); $dialogdel->withdraw; ###################################################################### +#3 $mw->Button( -text => 'Delete', -bg=>'yellow', -activebackground=>'orange', -command => \&delete_key)->pack; MainLoop; sub delete_key{ $dialogdel->deiconify; $dialogdel->focus; $dialogdel->grab; }

I'm not really a human, but I play one on earth. ..... an animated JAPH

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1217446]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (1)
As of 2024-04-25 04:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found