Re: perltray/tk intercept windows minimize function

listmail <[email protected]>
Newsgroups gmane.comp.lang.perl.tk
Message-ID <[email protected]>
Nick Ing-Simmons wrote:

>Listmail <[email protected]> writes:
>  
>
>>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.
>>    
>>
>
>
>I believe if you mark the window as 'transient' - like a popup
>then you don't get a minimize button. Is that any help?
>
>  
>
honestly no, but I do appreciate you taking time to respond

>>google shows similar questions have been asked, but I haven't been able 
>>to determine what I need to do when using perltray.  
>>    
>>
>
>What is "perltray" ?
>  
>
Part of the ActiveState Perl Development Kit, which basically runs your 
perl application(s) from the
windows system tray. The app does not have to incorporate Tk.

>  
>
>>Sorry if I'm beating a dead horse, 
>>but I think this would
>>be something a few people would like to achieve.
>>    
>>
>
>Overriding standard GUI behaviour should not be done lightly.
>If the platfrom has a minimize button it should minimize.
>
>It should NOT withdraw - how does the poor user get it back once 
>(say) he has Copy-ed something from a window and wants to Paste it in?
>
>Or if Copy/Paste isn't possible suppose it is minimized so they can do other 
>work until than can get it back and ask someone about it.
>
>"Doctor the machine said something about the patient's heart,
> I have the message here somewhere..."
>  
>
I'm not sure what that last bit is all about :), but the user uses the 
application like a vast majority of other applications coded to run in 
the system tray by interacting with the system tray icon as opposed to a 
task bar button. Typically, double clicking the system tray icon redraws 
the application right where it left off or right clicking the system 
tray  icon can provide the user with a menu with that contains that same 
"redraw" option as well a few others like "hide" and "exit" (as shown 
below).   Most "system tray" applications that I know of  create a  
"minimize to the system tray" effect instead of remaining a task bar 
button. Some may or may not remain running in the system tray when  you 
hit the window manager's close button.  Usually applications can have a 
configuration setting that allows for that functionality .  Microsoft 
Outlook can be told to minimize to the system tray for example and get 
out of your way while still collecting email.  GuildFTPd can be told not 
to exit when clicking the close button so that the server portion 
remains running.  These two combined features do fit well for an 
application that does some sort of monitoring and administering.

If the monitoring application discovered something,  how would the user 
be aware of it if it was minimized?  Balloon pop ups above that same 
system tray icon,  which perltray does a fine job handling.

My production application allows me, the computer operators, and a 
portion of IT to effectively monitor ERP systems without having to 
'babysit' and empowers the IT members with the ability to fix a few 
problems without having to call me.   Sometimes I have to train them to 
use my applications and thats ok since they made a career out of working 
with and fixing computers.  I certainly do not see anything uncommon in 
my request other than trying to achieve it through perltray where there 
isn't a more direct tie to the window manager.  More than likely this 
could be achieved through some amount of additional code, calling the 
Win32:GUI, Win32::API: modules and what not, but that is currently 
beyond my coding abilities, at the moment :).

>
>  
>
>>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]
>>    
>>
>
>
>-++**==--++**==--++**==--++**==--++**==--++**==--++**==
>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]
>
>---------------------------------------------------------------------------------------------------
>Text inserted by Panda Platinum 2006 Internet Security:
>
> This message has NOT been classified as spam. If it is unsolicited mail (spam), click on the following link to reclassify it: http://127.0.0.1:6083/Panda?ID=pav_793&SPAM=true
>---------------------------------------------------------------------------------------------------
>
>
>  
>
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.