• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 846
  • Last Modified:

Bring window to front in Tk GUI in Windows

I have some code that uses Tk. It launches a word document then closes it. Problem is when it closes the word document the tk window falls back to where other apps are on top of it. I need the tk window to be the top most window after the word document closes. I tried focus, grab, etc... and I haven't found any way in windows to bring the tk window in front of all other windows so its in the users face. Thanks! Any advice or simple code I can add to do this?

use Tk;
$mw = MainWindow->new();
$mw->geometry("400x170");
MainLoop;

#Open document....
#Does some stuff....
#Close Document....
#Now I want the $mw to jump out in front of the users face on top of all other windows whether they are Tk perl related or lets say firefox, internet explorer, excel, etc....

Open in new window

0
KGNickl
Asked:
KGNickl
1 Solution
 
Carl BohmanCommented:
I've never used it before, but there appears to be a module for that:
http://search.cpan.org/~gbrock/Tk-StayOnTop-0.12/lib/Tk/StayOnTop.pm

Even if you don't use the module, you might be able to look at the source code and find a way that works for you.

The basic approach I would try is to turn on the "stay on top" feature for your window (which should force your window to the top), then immediately turn that off (unless you have a good reason to keep it on).
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now