Re: clist column autosizing issues



When I issue a $clist->columns_autosize; the columns of $clist are sized
to appropriate sizes for the content, but not the titles.  For example:

my $clist = 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(@$_);
}

$clist->columns_autosize;

When I run code like this the rowsize column gets set to a width smaller
than the Gtk::Label.  I have tried to fix this by replacing the call to
columns_autosize with code that looks like this:

for (my $i = 0; $i < $clist->columns; $i++) {
      my $widget    = $clist->get_column_widget($i);
      my $width     = (@{$widget->allocation})[2];
      my $opt_width = $clist->optimal_column_width($i);
      $clist->set_column_width($i, $opt_width) if $width < $opt_width;
}

but $width is equal to 1 for every row.  Any ideas about what I am doing
wrong?


I've written a test from your example (attached). Everything works fine.
Columns are resized as expected.
Could you send a complete test reflecting that strange behavior?

Attachment: tcl1.pl
Description: tcl1.pl

Attachment: tcl1.out
Description: tcl1.out

Best regards
Pavel.


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