Listctrl项值不会更改 [英] Listctrl item value does not change

查看:96
本文介绍了Listctrl项值不会更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个CListCtrl dervied类,我在其中创建了3列。现在使用InsertItem添加第一行然后为每个列设置文本我可以显示这些列。

现在我再次为其已经可用的列表ctrl项目索引设置文本,但这次文本没有得到更新。



我正在使用listCtrl.SetItemText()api。

我尝试使用Update(),UpdateData()api,但没有一个工作。



就像:

sr.no输入输出状态

1 file.txt file.ext In进度



所以情况就像这个listctrl显示导出的文件状态一旦导出我必须将此状态设置为'已完成'

因此,当我这样做时,它不会改变文本。



sr.no输入输出状态

1 file.txt file.ext已完成

这就是我的意思想要。





有人能告诉我怎么办。



我尝试了什么:



我尝试过更新,updatadata api。

解决方案

< blockquote>检查 CListCtrl :: SetItemText 的返回值[ ^ ]。如果是 FALSE ,请检查您是否传递了有效的 nItem (行)和 nSubItem (列)参数。



假设它是第一行,状态是第4列,它应该是:

 VERIFY(listCtrl.SetItemText( 0  3 ,_ T( 已完成))); 

VERIFY 当调用返回 FALSE 时,宏将在调试版本中引发一个断言,并且在发布版本中什么都不做。



如果呼叫成功,则无需更新列表,因为如果未禁用重绘,则将通过呼叫完成。或者您之前是否打电话给 listCtrl.SetRedraw(FALSE)并忘记重新启用重绘?


Hi all ,

I have a CListCtrl dervied class in which I have created 3 column .Now when adding first row using InsertItem and then setting text to each one of these columns I can display the row .
Now I am again setting the text for its already available list ctrl item index but this time the text is not getting updated .

I am using listCtrl.SetItemText() api .
I tried using Update(),UpdateData() api's but none of them worked .

it is like :
sr.no Input Output Status
1 file.txt file.ext In progress

So the case is like this listctrl showns the status of the file being exported now once exported I have to set this status to ' Completed '
So when I m doing so it is not changing the text.

sr.no Input Output Status
1 file.txt file.ext Completed
This is what I want .


Can somebody tell me how to go about it.

What I have tried:

I tried update , updatadata api.

解决方案

Check the return value of CListCtrl::SetItemText[^]. If that is FALSE, check if you passed valid nItem (row) and nSubItem (column) parameters.

Assuming it is the first row and Status is the 4th column it should be:

VERIFY(listCtrl.SetItemText(0, 3, _T("Completed")));

The VERIFY macro will raise an assertion in debug builds when the call returns FALSE and does nothing in release builds.

If the call succeeds there is no need to update the list because that will be done by the call if redrawing is not disabled. Or did you call listCtrl.SetRedraw(FALSE) before and forgot to re-enable redrawing?


这篇关于Listctrl项值不会更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆