Home > Archive > PerlTk > December 2005 > How to deactivate only maximize/restore button?
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
How to deactivate only maximize/restore button?
|
|
| cengizhanacar@googlemail.com 2005-12-09, 7:15 pm |
| Hi,
Does anybody know how only the maximize/restore button can be
deactivated? If i use the following code, minimize button is also
disappears and only the exit button stays on the right corner.
my $mw=tkinit;
$mw->geometry("0x0");
$mw->overrideredirect(1);
my $main = $mw->Toplevel;
$main->transient($mw);
$main->protocol('WM_DELETE_WINDOW' => sub {exit(0)});
Thank you,
Cengiz
| |
| Rob Seegel 2005-12-09, 7:15 pm |
| cengizhanacar@googlemail.com wrote:
> Hi,
>
> Does anybody know how only the maximize/restore button can be
> deactivated? If i use the following code, minimize button is also
> disappears and only the exit button stays on the right corner.
>
> my $mw=tkinit;
> $mw->geometry("0x0");
> $mw->overrideredirect(1);
> my $main = $mw->Toplevel;
> $main->transient($mw);
> $main->protocol('WM_DELETE_WINDOW' => sub {exit(0)});
Whatever solution you find is likely to be platform specific and tied to
a specific Window Manager. By way of example, I recently found a way to
remove individual decorations from a Win32 window. Note that it involves
intervention of Win32::GUI. As a side note, this example led me to
discover that the HWND returned by MainWindow, was not the same HWND
returned by Win32::GUI::FindWindow. This came as a mild surprise, since
I've generally had good luck with the HWND's returned by other GUI widgets.
use Tk;
use Win32::GUI;
my $mw = MainWindow->new;
$mw->title("Hello");
$mw->update;
my ($winH) = Win32::GUI::FindWindow("", "Hello");
my $style = Win32::GUI::GetWindowLong($winH, -16);
$style &= ~(WS_MINIMIZEBOX | WS_MAXIMIZEBOX);
Win32::GUI::SetWindowLong($winH, -16, $style);
Win32::GUI::DrawMenuBar($winH);
MainLoop;
Rob
>
> Thank you,
> Cengiz
>
| |
| lock.number@gmail.com 2005-12-13, 9:57 pm |
| $mw->resizable('no','no');
This won't allow the window to be resized at all. (it greys out the
maximize button)
|
|
|
|
|