如何在cvslistbox中使项目不可编辑? [英] How to make items non editable in cvslistbox?

查看:170
本文介绍了如何在cvslistbox中使项目不可编辑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我正在使用CVSListBox并想让这些项目不可编辑。

是否可以制作CVSListBox中不可编辑的项目?

我还想在CVSListBox中的项目列表中更改选项时添加一些功能。如何实现这些要求?

是有没有像CVSListBox的ON_LBN_SELCHANGE这样的消息?



提前谢谢。



我有什么试过:



我尝试使用EnableWindow(FALSE),但它会使控件不可编辑。

Hi,

I am using CVSListBox and wants to make the items to be non editable.
Is it possible to make the items non editable in CVSListBox?
Also i want to add some functionality while changing the selection in the list of item present in the CVSListBox.How to achieve these requirement?
Is there any message like ON_LBN_SELCHANGE for CVSListBox ?

Thanks in advance.

What I have tried:

I tried with EnableWindow(FALSE) but it will make control non editable.

推荐答案

您可以从CVSListBox派生自己的类并覆盖虚拟方法

BOOL EditItem(int iItem){return FALSE;}

返回false。

由于在这种情况下新的和删除按钮可能没用

你可以通过在

中设置所需的标志来删除它们.BetStandardButtons(UINT uiBtns = AFX_VSLISTBOX _BTN_NEW | AFX_VSLISTBOX_BTN_DELETE | AFX_VSLISTBOX_BTN_UP | AFX_VSLISTBOX_BTN_DOWN)。

关于第二个问题,您可以使用LVN_ITEMCHANGED通知。
You may derive your own class from CVSListBox and override the virtual method
BOOL EditItem(int iItem){return FALSE;}
returning false.
Since the new and delete buttons may be useless in this situation
you may remove any of them by setting the desired flags in
SetStandardButtons(UINT uiBtns = AFX_VSLISTBOX_BTN_NEW | AFX_VSLISTBOX_BTN_DELETE | AFX_VSLISTBOX_BTN_UP | AFX_VSLISTBOX_BTN_DOWN).
As for your second question, you may use the LVN_ITEMCHANGED notification.


这篇关于如何在cvslistbox中使项目不可编辑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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