Nesting scrolled windows



Hi,

Out of curiosity I wanted to see what would happen if I nested
some scrolled windows.

I can't seem to get the leftmost "main" scrollbar to scroll.
I realize that things are working okay, but was wondering if there is some
technique to make that main adjustment work, by shrinking it's page_size or something?
I would be happy just to get the main scrollbar to do a + or - 1 unit.
In the sample script below, if you uncomment the line setting
the $hbox's set_size_request, you will see it work(partially) as desired.
If I try to increase the $hbox's vertical request, the individual list scrollbars
do the adjusting.

This isn't important, I was just wondering if this type of setup is possible?

#!/usr/bin/perl
use warnings;
use strict;
use Gtk2 -init;
use Gtk2::SimpleList;

my $window = Gtk2::Window->new;
$window->set_default_size( 400, 250 );
$window->signal_connect( destroy => sub { Gtk2->main_quit } );

my $vbox = Gtk2::VBox->new( 0, 10 );

my $scwin = Gtk2::ScrolledWindow->new();
my $va1   = $scwin->get_vadjustment;

#$scwin->set('window-placement-set'=>1);
$scwin->set_placement('top-right');

$vbox->pack_start( $scwin, 1, 1, 10 );
$window->add( $vbox );

my $hbox = Gtk2::HBox->new( 0, 10 );

#############################
# uncomment following line and see it partially works as desired 
# $hbox->set_size_request(1500,300);
#############################

$scwin->add_with_viewport($hbox);
$scwin->set_policy('always', 'always');

my %scwins;
my @data = ('a'..'z');

foreach my $num(1..10){
 $scwins{$num}{'scwin'} = Gtk2::ScrolledWindow->new();
 $hbox->pack_start($scwins{$num}{'scwin'},1,1,10);

 my $categories = Gtk2::SimpleList->new ($num => 'text');
 $categories->set_size_request(-1,10);
 @{$categories->{data}} = @data;
 $scwins{$num}{'scwin'}->add($categories);

}

$window->show_all;

Gtk2->main;
__END__

Thanks, 
zentara

-- 
I'm not really a human, but I play one on earth.
http://zentara.net/Remember_How_Lucky_You_Are.html 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]