Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Controls
  New Posts New Posts RSS Feed - CXTPControlEditCtrl::OnKeyDown
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPControlEditCtrl::OnKeyDown

 Post Reply Post Reply
Author
Message
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 886
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Topic: CXTPControlEditCtrl::OnKeyDown
    Posted: 13 December 2021 at 2:45pm
I want the CXTPControlEditCtrl to execute if the user presses the return key. I found CXTPControlEditCtrl::OnKeyDown does just that. But it isn't even called in my case. I have added a CXTPControlEdit on our ribbon and it implements OnHookKeyDown. In that code it traps VK_RETURN and VK_CHAR and returns FALSE.

What do I do to get the CXTPControlEditCtrl contol to get the OnKeyDown message handler to execute? Key down is in it's message map. So is mouse move and that fires when I move the mouse over the edit control.

I have my own CXTPControlEditCtrl subclass. I added an OnKeyDown handler. It is called but not for VK_RETURN. I think that hooker being used is stopping the control edit ctrl from getting the message it needs and deserves.

Don't know if it is the hooker but I have to be careful where I set breakpoints in OnHookKeyDown - visual studio break point trips and then VS quits responding and I have to kill it via task manager.
Back to Top
rdhd View Drop Down
Senior Member
Senior Member
Avatar

Joined: 13 August 2007
Location: United States
Status: Offline
Points: 886
Post Options Post Options   Thanks (0) Thanks(0)   Quote rdhd Quote  Post ReplyReply Direct Link To This Post Posted: 13 December 2021 at 3:47pm
This seems slightly wrong but I finally overrode OnHookKeyDown and called the CXTPControlEdit::OnHookKeyDown. If it returns FALSE (not FALSE_EXIT - A slight "misuse" of BOOL) I see if nChar was VK_RETURN and if so, I called GetEditCtrl and then GetControlEdit and called OnExecute directly.

I still can't quite fathom what this hooker returning FALSE is for or why the code isn't executing without me jumping thru these hoops. Its like the buddy button is a must. Without it and this new code, I wouldn't have been able to get the user to hit return to perform my action.

I added the buddy button first and did not avoid that code when I found return not working. I did search thru the CJ edit code to see if the buddy button had anything to do with return not working but I didn't see anything obvious so I left that code as is. Besides, I want both a buddy click or a return to execute my code.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.110 seconds.