Tk::StayOnTop - Keep your window in the foreground
use Tk::StayOnTop; $toplevel->stayOnTop; $toplevel->dontStayOnTop;
Adds methods to the Tk::Toplevel base class so that a window can stay on top off all other windows.
Keep $toplevel in the foreground.
Return $toplevel to normal behaviour.
The module uses a number of methods for trying to keep the window in the foreground. It will atomatically choose the most suitable available. The methods can be split between Microsoft Windows and X-Windows:
- Microsoft Windows
Perl Tk Version 804.027 and newer support the "-toplevel => 1" attribute. This will be used if possible.
On older Perl Tk versions, the module will search for the Win32::API module and use direct API calls to the OS.
For newer X window managers (Gnome, myabe KDE) it will try to set the NET_WM_STATE_STAYS_ON_TOP property of the window.
If this is not implemented, it will just try to the raise window every time it's covered. This could cause problems if you have two windows competing to stay on top.
I am hoping that the Perl Tk build in "-toplevel => 1" attribute will be implement in the future and this module will no longer be needed. However in the mean time, if you have any other platform dependent solutions, please let me know and I will try to include them.
See limits in X-Windows functionality descibed above.
This module is Copyright (c) 2004 Gavin Brock firstname.lastname@example.org. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Many thanks to Slaven Rezic for his many implemntation suggestions.