Tk:WM $toplevel->protocol - Perl

This is a discussion on Tk:WM $toplevel->protocol - Perl ; This is a multi-part message in MIME format. --------------010201060307010708080206 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit The following works well for making the Windows WM Close button result in a sub call instead of killing a Tk application: (example) $mw->protocol('WM_DELETE_WINDOW', sub{ ...

+ Reply to Thread
Results 1 to 2 of 2

Tk:WM $toplevel->protocol

  1. Default Tk:WM $toplevel->protocol

    This is a multi-part message in MIME format.
    --------------010201060307010708080206
    Content-Type: text/plain; charset=ISO-8859-1; format=flowed
    Content-Transfer-Encoding: 7bit

    The following works well for making the Windows WM Close button result
    in a sub call instead of killing a Tk application:
    (example) $mw->protocol('WM_DELETE_WINDOW', sub{ $mw->withdraw; });

    My question is can I do the same for the MINIMIZE button? I can't seem
    to find a protocol name that works. Does one exist or can I acheive
    this another way?

    --------------010201060307010708080206
    Content-Type: text/html; charset=ISO-8859-1
    Content-Transfer-Encoding: 7bit

    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
    </head>
    <body bgcolor="#ffffff" text="#000000">
    <font face="Courier New, Courier, monospace">The following works well
    for making the Windows WM Close button result in a sub call instead of
    killing a Tk application:<br>
    (example) $mw-&gt;protocol('WM_DELETE_WINDOW', sub{ $mw-&gt;withdraw;
    });<br>
    <br>
    My question is can I do the same for the MINIMIZE button?&nbsp; I can't seem
    to find a protocol name that works.&nbsp; Does one exist or can I acheive
    this another way?<br>
    </font>
    </body>
    </html>

    --------------010201060307010708080206--
    -++**==--++**==--++**==--++**==--++**==--++**==--++**==
    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 majordomo@lists.stanford.edu


  2. Default Re: Tk:WM $toplevel->protocol

    On Mon, 13 Feb 2006 23:04:20 +0000 (UTC), listmail
    <listmail@triad.rr.com> wrote:

    >This is a multi-part message in MIME format.
    >--------------010201060307010708080206
    >Content-Type: text/plain; charset=ISO-8859-1; format=flowed
    >Content-Transfer-Encoding: 7bit
    >
    >The following works well for making the Windows WM Close button result
    >in a sub call instead of killing a Tk application:
    >(example) $mw->protocol('WM_DELETE_WINDOW', sub{ $mw->withdraw; });
    >
    >My question is can I do the same for the MINIMIZE button? I can't seem
    >to find a protocol name that works. Does one exist or can I acheive
    >this another way?


    Hi, it would be better if you posted plain text to this list. Many
    people ignore html here if it is hard to read.

    I don't think there is a corresponding protocol for minimize.
    The best you can do is catch the event, by binding "<Unmap>"

    #!/usr/bin/perl
    use warnings;
    use strict;
    use Tk;

    my $mw = new MainWindow;
    $mw->title("Minimize test");
    $mw->geometry("400x250");
    $mw->bind("<Unmap>",sub{ print "unmap event\n" });
    MainLoop;

    __END__


    --
    I'm not really a human, but I play one on earth.
    http://zentara.net/japh.html

+ Reply to Thread

Similar Threads

  1. Looping at toplevel?
    By Application Development in forum lisp
    Replies: 6
    Last Post: 12-13-2007, 11:53 AM
  2. toplevel in a container
    By Application Development in forum TCL
    Replies: 4
    Last Post: 11-03-2007, 03:45 PM
  3. TopLevel window management
    By Application Development in forum Perl
    Replies: 3
    Last Post: 02-01-2007, 09:03 AM
  4. $mw->TopLevel Fail ??
    By Application Development in forum Perl
    Replies: 2
    Last Post: 06-08-2006, 08:24 PM
  5. Toplevel Groups
    By Application Development in forum Perl
    Replies: 2
    Last Post: 08-31-2005, 04:01 AM