[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: window resizing
- From: "Tijmen Ruizendaal" <tijmen ruizendaal gmail com>
- To: "Jaap Karssenberg" <j g karssenberg student utwente nl>
- Cc: gtk-perl-list gnome org
- Subject: Re: window resizing
- Date: Sat, 6 Oct 2007 21:40:45 +0200
On a usability note, wouldn't it be very anoying if the 'next' button
moves from place, because the window is auto resizing everytime?
This is not a solution ofcourse, but this was the first thing which
came to my mind. Maybe add a key shortcut as well?
Bye,
Tijmen
On 10/6/07, Jaap Karssenberg <j g karssenberg student utwente nl> wrote:
> Hi,
>
> Hmmm looks like "$window->set_policy()" should be available to set that
> behavior [1]. However perl Gtk2::Window does not seem to have a binding
> for this call. The C docs suggest to use set_resizable instead of
> set_policy, but no mention there of any auto behavior. Anyone knows why
> this call is missing ?
>
>
> [1]
> http://library.gnome.org/devel/gtk/2.11/GtkWindow.html#gtk-window-set-policy
>
> Regards,
>
> Jaap
>
>
> Laurent Klinger wrote:
> > Hello,
> >
> > I have a simple application, whose toplevel window has the following
> > structure :
> >
> > +-VBox----------------------+
> > | [Image] |
> > +---------------------------+
> > |+--HBox-------------------+|
> > || [Next] [Quit]||
> > |+-------------------------+|
> > +---------------------------+
> >
> > When it starts, it displays an image. Upon clicking on the 'Next'
> > button, another image is read and displayed.
> >
> > When the second image displayed is larger than the first, everything
> > resizes nicely to accomodate. However, when the second image is smaller
> > than the first, the window does not shrink: [Image] has some empty
> > space on both sides, while the HBox has some empty space below. I can
> > manually resize (downsize) the window, but it would be nicer if it
> > would fit tightly to its content by itself. How do you ask GTK to
> > adopt this kind of behaviour?
> >
> > Thank you very much for your help,
> >
> > laurent
> >
> >
> >
> > ----------------------------------------------------------------------------
> > #!/usr/bin/perl -w
> >
> > use strict;
> > use Gtk2 -init;
> > use Glib qw/TRUE FALSE/;
> >
> >
> > my $image = undef;
> > my $fig = 1;
> >
> > #===== create window
> > my $window = Gtk2::Window->new ('toplevel');
> > $window->set_resizable( TRUE );
> > $window->signal_connect( delete_event => \&Quit );
> >
> > #===== add widgets
> > GetImage( $fig );
> >
> > my $next_btn = Gtk2::Button->new( 'Next' );
> > $next_btn->signal_connect( 'clicked', sub{ GetImage( ++$fig ); } );
> > my $close_btn = Gtk2::Button->new_from_stock( 'gtk-close' );
> > $close_btn->signal_connect( 'clicked' , sub{ Gtk2->main_quit; } ) ;
> >
> > my $hbox = Gtk2::HBox->new( FALSE, 5 );
> > $hbox->pack_end( $close_btn, FALSE, TRUE, 5 );
> > $hbox->pack_end( $next_btn, FALSE, TRUE, 5 );
> >
> > my $vbox = Gtk2::VBox->new(FALSE,0);
> > $vbox->pack_start( $image, FALSE, FALSE, 0 );
> > $vbox->pack_start( $hbox, FALSE, FALSE, 10 );
> >
> > $window->add($vbox);
> > $window->set_position( 'center' );
> > $window->show_all;
> >
> > Gtk2->main;
> >
> >
> > #================================================================================
> > sub GetImage
> > {
> > my $id = shift;
> > my $pixbuf = Gtk2::Gdk::Pixbuf->new_from_file( "fig${id}.png" );
> > if ( defined $image ) {
> > $image->clear;
> > $image->set_from_pixbuf( $pixbuf );
> > } else {
> > $image = Gtk2::Image->new_from_pixbuf( $pixbuf );
> > }
> > }
> >
> > _______________________________________________
> > gtk-perl-list mailing list
> > gtk-perl-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtk-perl-list
> >
> >
>
> _______________________________________________
> gtk-perl-list mailing list
> gtk-perl-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-perl-list
>
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]