BUG: ESC/ENTER Keys Don't Work When Editing Labels in TreeViewLast reviewed: February 1, 1996Article ID: Q130691 |
The information in this article applies to:
SYMPTOMSWhen editing labels in a TreeView control, you should be able to press the ESC key to cancel the changes or press the ENTER key to accept the changes. However, when the TreeView control is contained in a dialog box, IsDialogMessage processes the ESC and ENTER keystrokes and does not pass them on to the edit control created by the TreeView control, so the keystrokes have no effect.
CAUSEThe TreeView control creates and subclasses the edit control used for in-place editing. The subclass procedure does not process the WM_GETDLGCODE and WM_CHAR messages for the edit control properly.
RESOLUTIONTo work around the problem, subclass the edit control and return DLGC_WANTALLKEYS in response to the WM_GETDLGCODE message. Then process the WM_CHAR messages for VK_ESCAPE and VK_RETURN. To subclass the edit control, obtain the handle to the edit control by using the TVM_GETEDITCONTROL message, then use normal subclassing techniques. The control should be subclassed in response to the TVN_BEGINLABELEDIT notification. Remove the subclassing when the TVN_ENDLABELEDIT notification is received. In response to the WM_CHAR|VK_ESCAPE message, have the application send the TVM_ENDEDITLABELNOW with fCancel = TRUE message to cancel the edit. In response to the WM_CHAR|VK_RETURN message, have the application send the TVM_ENDEDITLABELNOW with fCancel = FALSE message to accept the edit. All other WM_CHAR messages should be passed on to the default edit control window procedure.
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. We are researching this problem and will post new information here in the Microsoft Knowledge Base as it becomes available.
|
Additional reference words: 1.30 4.00 95
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |