Re: perltrak/tk intercept windows minimize function
Nick Ing-Simmons <[email protected]>
| Newsgroups | gmane.comp.lang.perl.tk |
|---|---|
| Message-ID | <[email protected]> |
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? > >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" ? >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..." > >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]