开发者

How to populate wxListCtrl?

开发者 https://www.devze.com 2023-01-02 14:46 出处:网络
I\'m trying to populate a wxListCtrl but after trying various methods can\'t seem to be able t开发者_StackOverflow中文版o populate it with items.

I'm trying to populate a wxListCtrl but after trying various methods can't seem to be able t开发者_StackOverflow中文版o populate it with items.

Basically, I want a list control that would have three columns with headings and will show values in rows. But I've tried InsertItem, SetItem, or InsertColumn methods but am only able to show the column headings but not the row data. Any help will be greatly appreciated! Thanks in advance!


You can add columns like this:

int column_width = 90;
my_list_ctrl->InsertColumn(0, L"ColumnText", wxLIST_FORMAT_LEFT, column_width);

You can add items like this:

int image_index = 0;
long list_index = my_list_ctrl->InsertItem(0, L"My Item text", image_index);

You can set the text of the subitems like this:

int column_index = 1;
my_list_ctrl->SetItem(list_index, column_index, L"Text");

You can setup an image list for your list like this:

my_list_ctrl->SetImageList(&img_list, wxIMAGE_LIST_SMALL);
0

精彩评论

暂无评论...
验证码 换一张
取 消