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++;
}
}
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.