#!/usr/bin/perl -- use strict; use warnings; use Wx; my $f = Wx::Frame->new(undef, -1, ""); ## this, otherwise nothing on screen, nada my $l = Wx::ListCtrl->new( $f, -1, [-1,-1], [-1,-1], Wx::wxLC_REPORT() ); $l->InsertColumn( $_, "column $_" ) for 0 .. 3; for my $col( 0 .. 2 ){ for( 0 .. 10 ){ if( $col == 0 ){ $l->InsertStringItem( $_, qq{row $_ col $col} ); } $l->SetItemString( $_, $col, qq{row $_ col $col} ) } $l->SetColumnWidth($col, Wx::wxLIST_AUTOSIZE() ); ## autosize after adding all items } for my $row ( 11 .. 20 ){ $l->AddStringItems ( map { "row $row col $_" } 0 .. 3 ) ; } $l->SetColumnWidth($_, Wx::wxLIST_AUTOSIZE() ) for 0 .. 3; for my $col ( 0 .. 3 ){ warn my $column0 = $l->GetColumn( $col ); $column0->SetText( $column0->GetText . " (?red?)" ); $column0->SetBackgroundColour( Wx::wxRED() ); $column0->SetTextColour( Wx::wxRED() ); warn my $column0font = $column0->GetFont; $column0font->SetPointSize( 12 + $column0font->GetPointSize ); $column0font->SetWeight( Wx::wxFONTWEIGHT_BOLD() ); $column0->SetFont( $column0font); warn $column0->GetFont; $l->Refresh; $l->SetColumn( $col, $column0); warn $l->GetColumn( $col ); } $f->Show(1); exit Wx::SimpleApp->new->MainLoop; sub Wx::ListCtrl::GetItemFont { $_[0]->GetItem($_[1])->GetFont } sub Wx::ListCtrl::SetItemFont { $_[0]->GetItem($_[1])->SetFont($_[2]) } sub Wx::ListCtrl::AddStringItems { #~ warn "@_\n"; my $l = shift; my $ix = $l->GetItemCount; $l->InsertStringItem( $ix, 'placeholder' ); my $col = 0; while(@_){ #~ warn "$ix $col $_[0] ", $l->SetItemString( $ix, $col, shift @_); $col++; } }