Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi All, is there a way to use $mw->overrideredirect(1); and to have the option to minimize and maximize the window? Also, is the a way to change the look (color) of the title bar and not just the title text?

Replies are listed 'Best First'.
Re: Perl Tk (Kinda urgent)
by Tux (Canon) on Jun 30, 2011 at 10:00 UTC
    • yes, but not using overrideredirect (). Look at the functions iconify (), raise (), deiconify (), focus (), and withdraw (). They are all described in Tk::Wm.
    • no, at least not on Linux/Unix. Decoration is part of the WM (KDE, Gnome, Windows)

    Enjoy, Have FUN! H.Merijn
Re: Perl Tk (Kinda urgent)
by zentara (Cardinal) on Jun 30, 2011 at 11:29 UTC
    Here is an example of how to manipulate an overrideredirect window, it does a drag, but you can use similar techniques, something like a shift-key binding, to minimize/maximize the window.
    #!/usr/bin/perl use warnings; use strict; use Tk; my $top = MainWindow->new; $top->geometry('200x200+200+200'); $top->overrideredirect(1); $top->Label( -text => 'Click and Drag' )->pack( -expand => 1, -fill => 'both' ); $top->Button( -text => 'Exit', -command => sub { $top->destroy } )->pack; my @deltaxy; $top->bind( '<1>' => \&getdelta ); $top->bind( '<B1-Motion>' => \&mousemove ); MainLoop; sub mousemove { my ( $width, $height, $x, $y ) = split /[+x]/, $top->geometry; $x = $top->pointerx - $deltaxy[0]; $y = $top->pointery - $deltaxy[1]; $top->geometry( $width . 'x' . $height . "+$x+$y" ); } sub getdelta { @deltaxy = ( $top->pointerx - $top->x, $top->pointery - $top->y ); }

    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh
      Thanks you, i know that but i dont know how to add the max/min function any suggestion ?