perltrak/tk intercept windows minimize function

listmail <[email protected]>
Newsgroups gmane.comp.lang.perl.tk
Message-ID <[email protected]>
Is there anyway to intercept when the user clicks the Minimize button on 
a tk window and call
$mw->withdraw instead?   I understand that the Minimize function is part 
of the Windows OS
window manager subsystem.

google shows similar questions have been asked, but I haven't been able 
to determine what
I need to do when using perltray.  Sorry if I'm beating a dead horse, 
but I think this would
be something a few people would like to achieve.

Note: I was able to call withdraw while clicking the Windows Close 
button (X)
by using the following: 
$mw->protocol('WM_DELETE_WINDOW', sub{ $mw->withdraw; })
This effectively creates a "~close~ to the system tray" feel when using 
perltray compiled code.

PDK 6.0.2
ActivePerl 5.8.7 build 813

#base code example (many thanks to Jan)
#!perl 
use strict; 
use warnings; 
use Tk; 
use PerlTray; 
 
our $mw = MainWindow->new(-title => 'test');

$mw->protocol('WM_DELETE_WINDOW', sub{ $mw->withdraw; });
 
$mw->Text(-height => 10, -width => 10) 
   ->pack(-fill => 'both', -expand =>1 ); 
 
sub PopupMenu { 
    return [["*show", sub { $mw->deiconify } ], 
            ["hide", sub { $mw->withdraw } ], 
            ["e&xit", "exit"], 
   ]; 
} 
 
 
sub Timer { 
    SetTimer(0); 
    MainLoop(); 
}

SetTimer(0.1); 


-++**==--++**==--++**==--++**==--++**==--++**==--++**==
This message was posted through the Stanford campus mailing list
server.  If you wish to unsubscribe from this mailing list, send the
message body of "unsubscribe ptk" to [email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.