Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Making a Perl/Tk window always stay on top

Status
Not open for further replies.

BenRussell

Programmer
Mar 12, 2001
243
US
How can I make my Tk window always stay on top, no matter what other windows are open? The Tk window is a window that displays advertisements (NOT spyware or adware in case youre wondering), and I need it to always be on top of other windows.

I also need it, when activated, to "push" everything else down (including the desk top).

Is this possible?

- Ben
 
Basically like NetZero and the other free internet providers used to do when you used their free internet service. Like how they used to display advertisements that were always on the screen.

- Ben
 
I'm not sure what you mean by pushing the desktop down, but to keep the window on top, install Tk::StayOnTop -

use Tk;
use Tk::StayOnTop;

$top = new MainWindow;
$top->stayOnTop;
MainLoop;

Works well under WinXP, haven't tried it in linux
 
Great, that works awesome for keeping it on top of other windows. However, what I mean by "pushing the window down" is that, for instnace, if this "ad window" is at the very top of the screen and the user wants to look at his/her desktop (with the icons on it), the top of the desktop should only reach the bottom of the ad window. Same for if the user was to open internet explorer and maximize it --- the top of internet explorer window would only reach the bottom of the ad window. Is this possible?

- Ben
 
That sounds like it could be pretty tricky. If you're on windows, maybe there's a function you can import using Win32::API
 
Any idea how to achieve this on Linux or a Mac also?

- Ben
 
You could try Tk::DockFrame to dock your program at the top. This may push down maximized programs, though I'm not sure. It certainly won't push down the desktop itself. That sounds like it'll take more low-level OS support, so you'd have to find a way to do it on each target operating system.

________________________________________
Andrew

I work for a gift card company!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top