Well, this isn't exactly what you're looking for, but it's close. It's somewhat similar to one of the postings in the suggested thread, but simpler.

use Tk; my $mw = MainWindow->new; my $toplevel = $mw->Toplevel; $toplevel->transient($mw); MainLoop;

You can also use overrideredirect as suggested in the thread but you will lose all window decorations, and will be forced to do something like this to move the window around:

use strict; use Tk; my $mw = MainWindow->new; $mw->overrideredirect(1); my $frame = $mw->Frame-> pack(-padx => 20, -pady => 20); $frame->Button( -text => 'Exit', -command => sub { Tk::exit } )->pack; my ($lastX, $lastY); $mw->bind('<Button1-Motion>', [\&MoveWindow, Ev('X'), Ev('Y'), \$lastX, \$lastY]); $mw->bind('<ButtonRelease-1>', [\&ClearCoords, \$lastX, \$lastY]); MainLoop; sub ClearCoords { my ($cw, $xSR, $ySR) = @_; undef($$xSR); undef($$ySR); } sub MoveWindow { my ($mw, $rootX, $rootY, $xSR, $ySR) = @_; if (!defined($$xSR) && !defined($$ySR)) { $$xSR = $rootX; $$ySR = $rootY; } else { my $xDiff = $rootX - $$xSR; my $yDiff = $rootY - $$ySR; my $x = $mw->x + $xDiff; my $y = $mw->y + $yDiff; $x = "+".$x if $x >= 0; $y = "+".$y if $y >= 0; $mw->geometry(sprintf("%dx%d%s%s", $mw->width, $mw->height, $x, $y )); $$xSR = $rootX; $$ySR = $rootY; } }

If you are working in a Win32 environment only, you might consider checking out Win32::GUI. What you're looking to do is fairly easy using it.

Rob

In reply to Removing maximize/minimize in Perl/Tk (Urgent query: PERL/Tk) by rcseege
in thread Urgent query : PERL/Tk by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.