ListBoxes and the magic of VKeyToItem()
-
I would like to capture when the user hits the return key when an item in the listbox is selected. However, it would seem that CListBox::VKeyToItem() captures most keystrokes, but only provides an irritating "beep" when I hit return. What I would like to do is to have the enter key register like a LBN_DBLCLK. Even if CListBox::VKeyToItem() did accept the return key, would it even be possible to have it enable items outside of the CListBox derived class I created?:confused: Any help is greatly appreciated. Thanks in advance.
-
I would like to capture when the user hits the return key when an item in the listbox is selected. However, it would seem that CListBox::VKeyToItem() captures most keystrokes, but only provides an irritating "beep" when I hit return. What I would like to do is to have the enter key register like a LBN_DBLCLK. Even if CListBox::VKeyToItem() did accept the return key, would it even be possible to have it enable items outside of the CListBox derived class I created?:confused: Any help is greatly appreciated. Thanks in advance.
Does your list box have the style LBS_WANTKEYBOARDINPUT? If so, OnVKeyToItem() should look something like this:
save status of base class CWnd::OnVKeyToItem() call;
get coords of index of item;
post WM_RBUTTONDBLCLK using those coordinates;
return status;/ravi "There is always one more bug..." ravib@cadence.com http://www.ravib.com
-
Does your list box have the style LBS_WANTKEYBOARDINPUT? If so, OnVKeyToItem() should look something like this:
save status of base class CWnd::OnVKeyToItem() call;
get coords of index of item;
post WM_RBUTTONDBLCLK using those coordinates;
return status;/ravi "There is always one more bug..." ravib@cadence.com http://www.ravib.com
Yes, I have LBS_WANTKEYBOARDINPUT. But, it does not seem that OnVKeyToItem is called when the enter key is hit. That is where I am having a major problem. Thanks, though.