How insert text into second column in wxListCtrl?

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
Bundy
I live to help wx-kind
I live to help wx-kind
Posts: 153
Joined: Fri Apr 29, 2005 9:46 am
Location: Poland

How insert text into second column in wxListCtrl?

Post by Bundy »

I can just insert text into first column doing somthing like this:

Code: Select all

a.SetText("sdaf");
a.SetId(0);
a.SetColumn(0);
WxListCtrl1->InsertItem(a);  
How to insert text into second column?
upCASE
Moderator
Moderator
Posts: 3176
Joined: Mon Aug 30, 2004 6:55 am
Location: Germany, Cologne

Post by upCASE »

Hi!
Use wxListCtrl::SetItem().
OS: OpenSuSE, Ubuntu, Win XP Pro
wx: svn
Compiler: gcc 4.5.1, VC 2008, eVC 4

"If it was hard to write it should be hard to read..." - the unknown coder
"Try not! Do. Or do not. There is no try." - Yoda
benedicte
wxWorld Domination!
wxWorld Domination!
Posts: 1409
Joined: Wed Jan 19, 2005 3:44 pm
Location: Paris, France

Post by benedicte »

wxwigets wrote: long index = widget.InsertItem (0, text_1);
widget.SetItem (index, 1, text_2);
widget.SetItem (index, 2, text_3);
columns are 0-based indexed.
Bundy
I live to help wx-kind
I live to help wx-kind
Posts: 153
Joined: Fri Apr 29, 2005 9:46 am
Location: Poland

Thanks, it works :)

Post by Bundy »

Now I must just sort data in listCtrl :)
Post Reply