用户按下字母键时如何停止CListCtrl的行选择? [英] How to stop the row selection of the CListCtrl when the user press the alphabetic keys?

查看:66
本文介绍了用户按下字母键时如何停止CListCtrl的行选择?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的对话框中有一个ClistCtrl.我有各种功能的快捷键.但是当焦点在CList ctrl上时,如果我按任意字母,所选文件就会更改.假设选择位于华盛顿,并且如果我按"I"键插入文件华盛顿,则我的选择在CListCtrl中更改,它将选择以我喜欢印度"开头的行...我想停止此自动选择...可以您建议我这样做的正确方法...在此先感谢

I have one ClistCtrl in my dialog. I have the shortcut keys for the various functionalities. But when the focus is on the CList ctrl , the selected file gets changed if i press any alphabet. Suppose selection is on Washington and if i pressed key "I" for inserting the file washington, my selection gets changed in CListCtrl and it will select an row with starting I like INDIA... i want to stop this auto selection... can u suggest me the right way to do so... thanks in advance

推荐答案

不确定这样做是否可行,只是一个建议:您不能覆盖键盘吗?事件处理程序:OnCharOnKeyDownOnKeyUp ...用于此控件?
Not sure this will work, just a suggestion: can''t you override the keyboard event handlers: OnChar, OnKeyDown, OnKeyUp... for this control ?


我认为您可以使用
I think you can handle this situation using PreTranslateMessage in your dialog box

if(pMsg->hwnd == m_MyList.GetSafeHwnd())
{
    if(pMsg->message == WM_KEYDOWN)
    {
            //you will enter here when the key is pressed on list control
    }
}


这篇关于用户按下字母键时如何停止CListCtrl的行选择?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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