本文介绍了如何从列表控件中获取旧值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要有关列表控件中某些问题的帮助.
我正在使用mfc的简单列表控件,我也想通过更改属性表及其完美工作来使其可编辑.
问题:我只想以这样一种方式来制作列表,使得列表控件中没有可用的重复数据.

注意:例如,我确实有一种解决方案,例如在事件LVN_ITEMCHANGED中将值存储在成员变量中,然后在事件LVN_ENDLABELEDIT中进行检查,如果发现数据已存在,则必须替换该值.由旧值控制列表.

问题:假设我确实编辑了一个项目并且不更改选择,然后再次单击进行编辑并输入了一些已经存在的值,那么倒数第二个而不是最后一个将被替换,这是因为LVN_ENDLABELEDIT事件不会被调用以获取最后一个值.
所以我需要某种帮助.
仅通过使用LVN_ENDLABELEDIT就有可能具有这种属性,并且我可以通过结构NMLVDISPINFOLV_DISPINFO获得列表控件的旧值吗?

我不想使用LVN_BEGINLABLEEDIT事件,因为它每次我在item中编辑文本时都会调用.

谢谢
我自己:在该块上有个新孩子.

I need some help regarding some problem in my list control .
I am using simple list control of mfc also i want to make it editable which i did by changing in property sheet and its perfectly working.
Question: i just want to make list such a way that no duplicate data is available in the list control.

Note: i do have one solution for example i store the value before editing in a member variable in event LVN_ITEMCHANGED and later check in event LVN_ENDLABELEDIT and if it is found data already exist then i do have to replace the value of the list control by the old value.

ISSUE: Suppose i do edit an item and do not change the selection then again i click for editing and do enter some values which is already existing then the second last value will be replaced not the last one.It is because the LVN_ENDLABELEDIT event is not being called to get the last value.
So what i need some kind of help.
Is it possible to have such kind of property just by using LVN_ENDLABELEDIT and i can get the old value of list control by the structure NMLVDISPINFO or LV_DISPINFO?

I don''t want to use the LVN_BEGINLABLEEDIT event as it calls everytime i edit a text in item.

Thank you
me myself :D new kid on the block.

推荐答案


这篇关于如何从列表控件中获取旧值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 04:39
查看更多