Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re^2: Wx::Perl: How to change/set font and size of Wx::ListCtrl column headings?

by Anonymous Monk
on Mar 26, 2013 at 16:34 UTC ( #1025554=note: print w/ replies, xml ) Need Help??


in reply to Re: Wx::Perl: How to change/set font and size of Wx::ListCtrl column headings?
in thread Wx::Perl: How to change/set font and size of Wx::ListCtrl column headings?

Pipe dream friend, pipe dream

#!/usr/bin/perl -- use strict; use warnings; use Wx; my $f = Wx::Frame->new(undef, -1, ""); ## this, otherwise nothing on s +creen, 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 aft +er 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++; } }


Comment on Re^2: Wx::Perl: How to change/set font and size of Wx::ListCtrl column headings?
Download Code
Re^3: Wx::Perl: How to change/set font and size of Wx::ListCtrl column headings?
by jmlynesjr (Pilgrim) on Mar 26, 2013 at 17:02 UTC

    No color or font changes for me when I ran your example.

    James

    There's never enough time to do it right, but always enough time to do it over...

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1025554]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2014-07-28 11:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (196 votes), past polls