Hi,

I don't think you can set the text colour of individual column items in a Wx::ListCtrl.

The following snippet uses a Wx::ListItem to set the text for a specific column, but the colour change gets applied to the whole line.

#-------------------------------------------------------

my $itemindex = .....
my $colindex = 1;

my $listitem = $listctrl->GetItem( $itemindex, $colindex );
$listitem->SetText( 'Replacement Text' );
$listitem->SetTextColour(Wx::Colour->new(255,0,0));
$listctrl->SetItem( $listitem );

#-------------------------------------------------------

I have updated Wx::TreeListCtrl to version 0.13 based on the latest source from http://wxcode.sourceforge.net/components/treelistctrl so now the methods that accept a column param should be wrapped. However, it does not seem to do what you require. I think setting text colour etc. will only work if the item you are setting is a Tree node.

I think that if you want a rich data representation in a table-like view, you may wish to try Wx::Grid. I has little documentation, but the Wx::Demo examples cover just about everything I think.

Hope it helps

Mark



On 20/06/2011 14:11, jeff wrote:
Trying to color individual columns and the column argument for
SetItemTextColour does not seem to be implemented.
Is this true?

Is there a way to color cells or columns individually ?

If you know a way to do the sam with wxlistctrl I would like to know as
well.
Thanks.
Jeff


wxTreeListCtrl::SetItemTextColour
void SetItemTextColour (const wxTreeItemId&  item, const wxColour&
colour)
void SetItemTextColour (const wxTreeItemId&  item, int column, const
wxColour&  colour)

Sets the colour of the item's or cell's text (foreground colour).



Reply via email to