Key Entry
-
Hi again! I now have another (simple) problem! I have a dialog box with a listbox control on it, which has been loaded with several strings. I want to be able to select a string, and then delete it by pressing the key. I havnt been able to detect any key being pressed. What do I need to do? I have used MFC Classwizard to add message handlers for WM_KEY_DOWN and WM_KEY_UP, but it doesnt seam to work - where am I going wrong? Thanks yet again!
-
Hi again! I now have another (simple) problem! I have a dialog box with a listbox control on it, which has been loaded with several strings. I want to be able to select a string, and then delete it by pressing the key. I havnt been able to detect any key being pressed. What do I need to do? I have used MFC Classwizard to add message handlers for WM_KEY_DOWN and WM_KEY_UP, but it doesnt seam to work - where am I going wrong? Thanks yet again!
You can subclass the control. Create message handler for
WM_KEYUP
message:void ..... OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if (nChar == VK_DELETE)
{
//delete the string here.
}CListBox::OnKeyUp(nChar, nRepCnt, nFlags);
}
Maybe there are better ways. this is this.
-
You can subclass the control. Create message handler for
WM_KEYUP
message:void ..... OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if (nChar == VK_DELETE)
{
//delete the string here.
}CListBox::OnKeyUp(nChar, nRepCnt, nFlags);
}
Maybe there are better ways. this is this.
Hi Khan++ Thanks for your help - yep thats got it now! Thanks again Mike