Re: stopping a window resize - answered
- From: zentara <zentara1 sbcglobal net>
- To: gtk-perl-list gnome org
- Subject: Re: stopping a window resize - answered
- Date: Tue, 24 Oct 2006 16:01:50 -0400
On Mon, 23 Oct 2006 16:15:36 -0400
zentara <zentara1 sbcglobal net> wrote:
$window->set_resizable(0);
dosn't work from a sub after a resize.
If you resize the window below, say enlarge it, then
hit start, the window reverts to it's original size.
Doh! Never mind. I finally realized it will go back to the latest
set_size_request(). So I just put that in just before I freeze it.
#!/usr/bin/perl
use warnings;
use strict;
use Gtk2 -init;
my $window = new Gtk2::Window ();
$window->signal_connect ("delete_event", sub { Gtk2->main_quit; });
$window->set_border_width (10);
$window->set_size_request(640,480);
$window->set_position('center');
my $button1 = Gtk2::Button->new('Start');
$window->add( $button1);
$button1->signal_connect( clicked => \&start);
$window->show_all;
Gtk2->main;
#######################################################
sub start{
my ($xscr, $yscr) = (Gtk2::Gdk->screen_width, Gtk2::Gdk->screen_height);
print "$xscr $yscr\n";
#get current window size and freeze it
my ($x0, $y0, $width0, $height0, $depth) = $window->window->get_geometry;
print "geometry x0->$x0, y0->$y0, width->$width0, height->$height0, depth->$depth\n";
$window->set_size_request($width0, $height0);
$window->set_resizable(0);
return 0;
}
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]