#!/usr/bin/perl
use strict;
use warnings;
use Tk;
use Tk::SMListbox;
use File::Slurp qw/read_file write_file/;
use File::Spec;
my $resfile = File::Spec->tmpdir().'/resfile.res';
write_file($resfile, <DATA>);
my $mw = MainWindow->new;
$mw->optionReadfile($resfile);
my $lbox = $mw->Scrolled('SMListbox',
-scrollbars => 'se',
-width => 480,
-height => 12,
-borderwidth => 1,
-columns => [
[ -text => 'Month', -width => 14 ],
[ -text => 'Sales', -width => 8 ],
[ -text => 'Contact', -width => 22 ],
],
);
$lbox->pack();
$mw->after(4000, sub { exit });
$lbox->insert('end', [January => 380114, 'jo...@example.com']);
$lbox->insert('end', [February => 322691, 'jo...@example.com']);
$lbox->insert('end', [March => 363277, 'bl...@example.com']);
MainLoop;
__DATA__
*CListbox.foreground: Arial 10 bold
__END__
The above program produces a segmentation fault on my system (Debian 5.0
i386).
SMListbox just adds sort controls to an MListbox. Does your code
segfault if you use MListbox instead?
I don't have Tk::MListbox installed.