Re: simplelist column width



I added set_max_width () function to Dave's code. After execution, I found the
column cannot be manually resized anymore. When I try to resize a column, its
width goes to zero and cannot never be drag back.

Why?

############################################################
#!/usr/bin/perl

use warnings;
use strict;

use Glib;
use Gtk2 -init;
use Gtk2::SimpleList;

use constant TRUE => 1;
use constant FALSE => !TRUE;

my $win = Gtk2::Window->new;

my $main_vbox = Gtk2::VBox->new (FALSE, 6);

$win->add ($main_vbox);

my $scrolled_win = Gtk2::ScrolledWindow->new;
$scrolled_win->set_shadow_type('etched_in');
$scrolled_win->set_policy( 'automatic', 'automatic' );
$main_vbox->pack_start( $scrolled_win, TRUE, TRUE, 0 );

my $slist = create_list();
$scrolled_win->add($slist);
$slist->get_selection->set_mode('single');
$slist->set_rules_hint(TRUE);

$slist->set_reorderable(FALSE);
map {
    $_->set_resizable(TRUE);
    $_->set_max_width(100);
} $slist->get_columns;

$slist->signal_connect( row_activated => \&row_clicked );

sub create_list {
    my $list = Gtk2::SimpleList->new(
        'File'   => 'text',
        'Type'   => 'text',
        'Size'   => 'text',
        'Status' => 'text',
    );

    return $list;
}

$win->show_all;

Gtk2->main;




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