CTreeCtrl in CControlBar = no TVN_ENDLABELEDIT?
William F. Cook -- wfcook@ix.netcom.com Tuesday, June 04, 1996 VC++ 4.0/Windows 95 I have a control bar in my app in which I have placed a CTreeCtrl. I need to allow the user to edit the text of a tree item in the standard way, i.e. clicking on it and waiting for the edit box to appear, similar to what happens in the tree pane of explorer when renaming a file or directory. The problem is that when the user presses ENTER or ESC, the CTreeCtrl doesn't seem to receive it, and I get no TVN_ENDLABELEDIT notification. Using SPY++, I have determined that there is a WM_COMMAND message coming through, and sometimes a WM_GETDLGCODE. My guess is that I am getting some kind of dialog box default button behavior, even though it isn't a dialog bar. I have played with WM_GETDLGCODE handling to no avail - though it's very possible I'm doing this incorrectly. I have searched the archives and MSDN, and re-read "Meandering Through the Maze of MFC Message and Command Routing" to no avail, but once again I could simply be using the wrong keywords. Any information regarding where the WM_CHAR is disappearing to would be extremely helpful! Bill Cook _/)_
Roger Onslow -- Roger_Onslow@compsys.com.au Tuesday, June 11, 1996 >VC++ 4.0/Windows 95 > >I have a control bar in my app in which I have placed a CTreeCtrl. I need >to allow the user to edit the text of a tree item in the standard way, >i.e. clicking on it and waiting for the edit box to appear, similar to >what happens in the tree pane of explorer when renaming a file or >directory. The problem is that when the user presses ENTER or ESC, the >CTreeCtrl doesn't seem to receive it, and I get no TVN_ENDLABELEDIT >notification. Using SPY++, I have determined that there is a WM_COMMAND >message coming through, and sometimes a WM_GETDLGCODE. My guess is that I >am getting some kind of dialog box default button behavior, even though it >isn't a dialog bar. I have played with WM_GETDLGCODE handling to no avail >- though it's very possible I'm doing this incorrectly. > >I have searched the archives and MSDN, and re-read "Meandering Through the >Maze of MFC Message and Command Routing" to no avail, but once again I >could simply be using the wrong keywords. > >Any information regarding where the WM_CHAR is disappearing to would be >extremely helpful! > >Bill Cook _/)_ > Keys get handled by main frame when it does accelerator key tests. Try overriding PreTranslateMessage (or OnKeyDown) to get these events and send/post directly to your control (Have a look at the MFC sample DOCKTOOL which includes a combo box which overrides PreTranslateMessage -- it's not a tree control, but is a control in a toolbar)
| Вернуться в корень Архива |