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

Re: How do I determine if a Tk window exists?

by Coruscate (Sexton)
on Jan 02, 2004 at 05:52 UTC ( [id://318249]=note: print w/replies, xml ) Need Help??


in reply to How do I determine if a Tk window exists?

use Win32::API; Win32::API->Import('user32', 'FindWindowA', 'PP', 'N'); my $title = 'Title/Window Caption of StatusBar Window'; if (FindWindowA(0, $title)) { # window exists, do status bar update }

Of course, that is Win32-specific. I couldn't help posting that. I've been fiddling with Win32's API lately and find it quite interesting (if at times frustrating because of Win32::API::Struct and other things). I haven't used Tk as of yet, so I can't be certain of this, but can you not keep a $status_open variable and hook into the event of a closed window and set the variable appropriately. Thus, before you update the status, check the variable to ensure the window is open. Doesn't stop the user from closing the window right in the middle of your update though. Why not create a status window the user cannot close (surely Tk allows you to create windows without minimize, maximize, closing functionality).

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-03-29 21:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found