#!/usr/bin/perl use Gtk 0.7006; use strict; Gtk->init(); my $window = new Gtk::Window('toplevel'); $window->signal_connect('delete_event', sub { Gtk->main_quit(); return 0; }); my $clist = new_with_titles Gtk::CList(qw(tabname owner partnum tabid rowsize)); my @data = ( [qw(systables informix 1048676 1 104)], [qw(syscolumns informix 1048677 2 36)], [qw(sysindexes informix 1048678 3 78)], [qw(systabauth informix 1048679 4 28)], ); foreach (@data) { $clist->append(@$_); } $window->add($clist); $window->show_all(); print_allocations($clist, "Before autosize"); $clist->columns_autosize; print_allocations($clist, "After autosize"); Gtk->main(); #------------------------------------------------------------ sub print_allocations { my($clist, $msg) = @_; print "$msg\n" if $msg; for (my $i = 0; $i < $clist->columns; $i++) { my $widget = $clist->get_column_widget($i); my $alloc = $widget->allocation(); print "$i: ", join(" ",@$alloc), "\n"; } }